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:
Javi Martín
2019-09-26 17:30:38 +02:00
parent 24f14ea772
commit a04a289850
10 changed files with 44 additions and 114 deletions

View File

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