Decouple tests from unspecified data ordering

These tests have been passing with SQLite, but don't reflect guaranteed
behavior and with PostgreSQL failed intermittently.
This commit is contained in:
Andrew Kvalheim 2020-03-20 06:24:47 -07:00
parent e6f3aa559e
commit a7006a4edd
5 changed files with 26 additions and 27 deletions

View file

@ -15,9 +15,7 @@ describe Api::V1::EventsController do
json = JSON.parse(response.body)['events']
expect(response).to be_success
expect(json.length).to eq(2)
expect(json[0]['title']).to eq('Example Event')
expect(json[1]['title']).to eq('Conference Event')
expect(json.map { |e| e['title'] }).to contain_exactly('Conference Event', 'Example Event')
end
end