Commit dc65400a authored by Bogdan Denkovych's avatar Bogdan Denkovych

Fix random spec failures due to non-deterministic order

Closes https://gitlab.com/gitlab-org/gitlab/-/issues/343862

See `contain_exactly` matcher docs
https://relishapp.com/rspec/rspec-expectations/docs/built-in-matchers/contain-exactly-matcher
By using this matcher we do not test the order of expected elements,
but  `Issue.public_only` and `Issue.without_hidden` seem to not
provide ordered returned elements.
parent 8abd656e
...@@ -1219,7 +1219,7 @@ RSpec.describe Issue do ...@@ -1219,7 +1219,7 @@ RSpec.describe Issue do
end end
it 'returns public and hidden issues' do it 'returns public and hidden issues' do
expect(described_class.public_only).to eq([public_issue, hidden_issue]) expect(described_class.public_only).to contain_exactly(public_issue, hidden_issue)
end end
end end
end end
...@@ -1248,7 +1248,7 @@ RSpec.describe Issue do ...@@ -1248,7 +1248,7 @@ RSpec.describe Issue do
end end
it 'returns public and hidden issues' do it 'returns public and hidden issues' do
expect(described_class.without_hidden).to eq([public_issue, hidden_issue]) expect(described_class.without_hidden).to contain_exactly(public_issue, hidden_issue)
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment