Use match_array instead of sorting arrays

It does the same thing, and it's easier to read.
This commit is contained in:
Javi Martín
2019-09-24 20:25:20 +02:00
parent 4a80653d2f
commit 98fe8349d7
4 changed files with 11 additions and 11 deletions

View File

@@ -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