Simplify testing arrays exact contents
Instead of testing the contents of each element, we can test the whole array at once.
This commit is contained in:
@@ -37,9 +37,7 @@ describe Topic do
|
||||
|
||||
results = community.topics.sort_by_newest
|
||||
|
||||
expect(results.first).to eq(topic3)
|
||||
expect(results.second).to eq(topic2)
|
||||
expect(results.third).to eq(topic1)
|
||||
expect(results).to eq [topic3, topic2, topic1]
|
||||
end
|
||||
|
||||
it "orders by oldest" do
|
||||
@@ -68,9 +66,7 @@ describe Topic do
|
||||
|
||||
results = community.topics.sort_by_most_commented
|
||||
|
||||
expect(results.first).to eq(topic1)
|
||||
expect(results.second).to eq(topic2)
|
||||
expect(results.third).to eq(topic3)
|
||||
expect(results).to eq [topic1, topic2, topic3]
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user