diff --git a/spec/proposals/commands/decidim/proposals/admin_update_proposal_category_spec.rb b/spec/proposals/commands/decidim/proposals/admin_update_proposal_category_spec.rb index 03a0663..0cb300c 100644 --- a/spec/proposals/commands/decidim/proposals/admin_update_proposal_category_spec.rb +++ b/spec/proposals/commands/decidim/proposals/admin_update_proposal_category_spec.rb @@ -9,7 +9,7 @@ module Admin describe "call" do let(:organization) { create(:organization) } - let!(:proposal) { create :proposal } + let!(:proposal) { create :extended_proposal } let!(:proposals) { create_list(:extended_proposal, 3, component: proposal.component) } let!(:category_one) { create :category, participatory_space: proposal.component.participatory_space } let!(:category) { create :category, participatory_space: proposal.component.participatory_space } diff --git a/spec/proposals/commands/decidim/proposals/admin_update_proposal_scope_spec.rb b/spec/proposals/commands/decidim/proposals/admin_update_proposal_scope_spec.rb index ef05118..6733621 100644 --- a/spec/proposals/commands/decidim/proposals/admin_update_proposal_scope_spec.rb +++ b/spec/proposals/commands/decidim/proposals/admin_update_proposal_scope_spec.rb @@ -7,7 +7,7 @@ module Proposals module Admin describe UpdateProposalScope do describe "call" do - let!(:proposal) { create :proposal } + let!(:proposal) { create :extended_proposal } let!(:proposals) { create_list(:extended_proposal, 3, component: proposal.component) } let!(:scope_one) { create :scope, organization: proposal.organization } let!(:scope) { create :scope, organization: proposal.organization } diff --git a/spec/proposals/commands/decidim/proposals/amendable/accept_amendment_spec.rb b/spec/proposals/commands/decidim/proposals/amendable/accept_amendment_spec.rb index 0cc16e4..8ca691d 100644 --- a/spec/proposals/commands/decidim/proposals/amendable/accept_amendment_spec.rb +++ b/spec/proposals/commands/decidim/proposals/amendable/accept_amendment_spec.rb @@ -29,7 +29,9 @@ module Amendable include_examples "accept amendment" do it "changes the emendation state" do - expect { command.call }.to change { emendation.reload[:state] }.from(nil).to("accepted") + not_answered = Decidim::CustomProposalStates::ProposalState.where(component: component, token: "not_answered").pick(:id) + accepted = Decidim::CustomProposalStates::ProposalState.where(component: component, token: "accepted").pick(:id) + expect { command.call }.to change { emendation.reload[:decidim_proposals_proposal_state_id] }.from(not_answered).to(accepted) end end end diff --git a/spec/proposals/commands/decidim/proposals/amendable/publish_amendment_draft_spec.rb b/spec/proposals/commands/decidim/proposals/amendable/publish_amendment_draft_spec.rb index 5c1a78c..0f1c12c 100644 --- a/spec/proposals/commands/decidim/proposals/amendable/publish_amendment_draft_spec.rb +++ b/spec/proposals/commands/decidim/proposals/amendable/publish_amendment_draft_spec.rb @@ -25,7 +25,9 @@ module Amendable include_examples "publish amendment draft" do it "changes the emendation state" do - expect { command.call }.to change { emendation.reload[:state] }.from(nil).to("evaluating") + not_answered = Decidim::CustomProposalStates::ProposalState.where(component: component, token: "not_answered").pick(:id) + evaluating = Decidim::CustomProposalStates::ProposalState.where(component: component, token: "evaluating").pick(:id) + expect { command.call }.to change { emendation.reload[:decidim_proposals_proposal_state_id] }.from(not_answered).to(evaluating) end end end diff --git a/spec/proposals/commands/decidim/proposals/amendable/reject_amendment_spec.rb b/spec/proposals/commands/decidim/proposals/amendable/reject_amendment_spec.rb index 9458712..1024e9c 100644 --- a/spec/proposals/commands/decidim/proposals/amendable/reject_amendment_spec.rb +++ b/spec/proposals/commands/decidim/proposals/amendable/reject_amendment_spec.rb @@ -30,7 +30,9 @@ module Amendable include_examples "reject amendment" do it "changes the emendation state" do - expect { command.call }.to change { emendation.reload[:state] }.from(nil).to("rejected") + not_answered = Decidim::CustomProposalStates::ProposalState.where(component: component, token: "not_answered").pick(:id) + rejected = Decidim::CustomProposalStates::ProposalState.where(component: component, token: "rejected").pick(:id) + expect { command.call }.to change { emendation.reload[:decidim_proposals_proposal_state_id] }.from(not_answered).to(rejected) end end end diff --git a/spec/proposals/commands/decidim/proposals/amendable/withdraw_amendment_spec.rb b/spec/proposals/commands/decidim/proposals/amendable/withdraw_amendment_spec.rb index b725426..b357123 100644 --- a/spec/proposals/commands/decidim/proposals/amendable/withdraw_amendment_spec.rb +++ b/spec/proposals/commands/decidim/proposals/amendable/withdraw_amendment_spec.rb @@ -17,7 +17,9 @@ module Amendable include_examples "withdraw amendment" do it "changes the emendation state" do - expect { command.call }.to change { emendation.reload[:state] }.from(nil).to("withdrawn") + not_answered = Decidim::CustomProposalStates::ProposalState.where(component: component, token: "not_answered").pick(:id) + withdrawn = Decidim::CustomProposalStates::ProposalState.where(component: component, token: "withdrawn").pick(:id) + expect { command.call }.to change { emendation.reload[:decidim_proposals_proposal_state_id] }.from(not_answered).to(withdrawn) end end end diff --git a/spec/proposals/forms/decidim/proposals/admin/import_participatory_text_form_spec.rb b/spec/proposals/forms/decidim/proposals/admin/import_participatory_text_form_spec.rb index 1779bc0..2f3878b 100644 --- a/spec/proposals/forms/decidim/proposals/admin/import_participatory_text_form_spec.rb +++ b/spec/proposals/forms/decidim/proposals/admin/import_participatory_text_form_spec.rb @@ -8,7 +8,7 @@ module Admin describe ImportParticipatoryTextForm do subject { form } - let(:component) { create :component, manifest_name: "proposals" } + let(:component) { create :extended_proposal_component } let(:title) do { ca: "Yes very good, patates amb suc",