diff --git a/spec/lib/acts_as_paranoid_aliases_spec.rb b/spec/lib/acts_as_paranoid_aliases_spec.rb index c304e6b62..b743039bf 100644 --- a/spec/lib/acts_as_paranoid_aliases_spec.rb +++ b/spec/lib/acts_as_paranoid_aliases_spec.rb @@ -9,7 +9,7 @@ describe "Paranoid methods" do debate3 = create(:debate) debate4 = create(:debate) - expect(Debate.all.sort).to eq([debate1, debate2, debate3, debate4].sort) + expect(Debate.all).to match_array [debate1, debate2, debate3, debate4] Debate.hide_all [debate1, debate2, debate4].map(&:id) @@ -30,7 +30,7 @@ describe "Paranoid methods" do Debate.restore_all [debate1, debate3].map(&:id) - expect(Debate.all.sort).to eq([debate1, debate2, debate3].sort) + expect(Debate.all).to match_array [debate1, debate2, debate3] end end diff --git a/spec/models/budget/investment_spec.rb b/spec/models/budget/investment_spec.rb index 5844c380c..d2621c41c 100644 --- a/spec/models/budget/investment_spec.rb +++ b/spec/models/budget/investment_spec.rb @@ -355,7 +355,7 @@ describe Budget::Investment do by_valuator = Budget::Investment.by_valuator(valuator1.id) - expect(by_valuator.sort).to eq([investment1, investment3].sort) + expect(by_valuator).to match_array [investment1, investment3] end end @@ -509,7 +509,7 @@ describe Budget::Investment do undecided_investment = create(:budget_investment, :undecided) feasible_investment = create(:budget_investment, :feasible) - expect(Budget::Investment.not_unfeasible.sort).to eq [undecided_investment, feasible_investment].sort + expect(Budget::Investment.not_unfeasible).to match_array [undecided_investment, feasible_investment] end end @@ -539,7 +539,7 @@ describe Budget::Investment do unselected_undecided_investment = create(:budget_investment, :unselected, :undecided) unselected_feasible_investment = create(:budget_investment, :unselected, :feasible) - expect(Budget::Investment.unselected.sort).to eq [unselected_undecided_investment, unselected_feasible_investment].sort + expect(Budget::Investment.unselected).to match_array [unselected_undecided_investment, unselected_feasible_investment] end end diff --git a/spec/models/poll/ballot_spec.rb b/spec/models/poll/ballot_spec.rb index 9d58184e2..7c1f8d883 100644 --- a/spec/models/poll/ballot_spec.rb +++ b/spec/models/poll/ballot_spec.rb @@ -21,7 +21,7 @@ describe Poll::Ballot do poll_ballot.update(data: [investment.id, investment2.id, investment3.id, investment4.id].join(",")) poll_ballot.verify - expect(poll_ballot.ballot.lines.pluck(:investment_id).sort).to eq([investment.id, investment2.id, investment3.id].sort) + expect(poll_ballot.ballot.lines.pluck(:investment_id)).to match_array [investment.id, investment2.id, investment3.id] end it "adds ballot lines if they are from valid headings" do @@ -34,7 +34,7 @@ describe Poll::Ballot do poll_ballot.update(data: [investment.id, investment2.id, investment3.id, investment4.id].join(",")) poll_ballot.verify - expect(poll_ballot.ballot.lines.pluck(:investment_id).sort).to eq([investment.id, investment2.id, investment3.id].sort) + expect(poll_ballot.ballot.lines.pluck(:investment_id)).to match_array [investment.id, investment2.id, investment3.id] end it "adds ballot lines if they are from selectable" do @@ -45,7 +45,7 @@ describe Poll::Ballot do poll_ballot.update(data: [investment.id, investment2.id, investment3.id, investment4.id].join(",")) poll_ballot.verify - expect(poll_ballot.ballot.lines.pluck(:investment_id).sort).to eq([investment.id, investment2.id, investment3.id].sort) + expect(poll_ballot.ballot.lines.pluck(:investment_id)).to match_array [investment.id, investment2.id, investment3.id] end end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index b7716b927..70e47eb19 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -580,7 +580,7 @@ describe User do user.take_votes_from other_user expect(other_user.votes.count).to eq(0) - expect(user.vote_ids.sort).to eq([v1.id, v2.id, v3.id].sort) + expect(user.vote_ids).to match_array [v1.id, v2.id, v3.id] end it "reassigns budget ballots from other user" do @@ -598,7 +598,7 @@ describe User do user.take_votes_from other_user expect(Budget::Ballot.where(user: other_user).count).to eq(0) - expect(Budget::Ballot.where(user: user).sort).to eq([b1, b2].sort) + expect(Budget::Ballot.where(user: user)).to match_array [b1, b2] end it "reassigns poll voters from other user" do @@ -616,7 +616,7 @@ describe User do user.take_votes_from other_user expect(Poll::Voter.where(user: other_user).count).to eq(0) - expect(Poll::Voter.where(user: user).sort).to eq([v1, v2].sort) + expect(Poll::Voter.where(user: user)).to match_array [v1, v2] end end