Check exact array contents instead of inclusion
We're using `eq` and `match_array` in most places, but there were a few places where we were still checking each element is included in the array. This is a bit dangerous, because the array could have duplicate elements, and we wouldn't detect them with `include`.
This commit is contained in:
@@ -707,7 +707,8 @@ describe Debate do
|
||||
describe "#last_week" do
|
||||
it "returns debates created this week" do
|
||||
debate = create(:debate)
|
||||
expect(Debate.last_week.all).to include debate
|
||||
|
||||
expect(Debate.last_week.all).to eq [debate]
|
||||
end
|
||||
|
||||
it "does not show debates created more than a week ago" do
|
||||
@@ -725,7 +726,8 @@ describe Debate do
|
||||
describe "public_for_api scope" do
|
||||
it "returns debates" do
|
||||
debate = create(:debate)
|
||||
expect(Debate.public_for_api).to include(debate)
|
||||
|
||||
expect(Debate.public_for_api).to eq [debate]
|
||||
end
|
||||
|
||||
it "does not return hidden debates" do
|
||||
|
||||
Reference in New Issue
Block a user