Skip to content

Commit

Permalink
Fix commands specs
Browse files Browse the repository at this point in the history
  • Loading branch information
alecslupu committed Dec 7, 2023
1 parent a6c6991 commit 413276b
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 413276b

Please sign in to comment.