diff options
author | Rémy Coutable <remy@rymai.me> | 2016-10-11 21:26:49 +0200 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-10-11 21:26:49 +0200 |
commit | c7865786572a3a2e12ed67a3f8121c0be8c4ba38 (patch) | |
tree | 303d2d97b5926447ffe6982c6794cad48f1950c7 /spec/requests | |
parent | 8e70cf25641fc023e146ac1632f89203a55ce6f9 (diff) | |
download | gitlab-ce-c7865786572a3a2e12ed67a3f8121c0be8c4ba38.tar.gz |
Make spec deterministicuser-events-api
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/users_spec.rb | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb index 91e54af1209..684c27f4353 100644 --- a/spec/requests/api/users_spec.rb +++ b/spec/requests/api/users_spec.rb @@ -926,20 +926,18 @@ describe API::API, api: true do it 'returns the "joined" event' do get api("/users/#{user.id}/events", user) - first_event = json_response.first + comment_event = json_response.find { |e| e['action_name'] == 'commented on' } - expect(first_event['action_name']).to eq('commented on') - expect(first_event['project_id'].to_i).to eq(project.id) - expect(first_event['author_username']).to eq(user.username) - expect(first_event['note']['id']).to eq(note.id) - expect(first_event['note']['body']).to eq('What an awesome day!') + expect(comment_event['project_id'].to_i).to eq(project.id) + expect(comment_event['author_username']).to eq(user.username) + expect(comment_event['note']['id']).to eq(note.id) + expect(comment_event['note']['body']).to eq('What an awesome day!') - last_event = json_response.last + joined_event = json_response.find { |e| e['action_name'] == 'joined' } - expect(last_event['action_name']).to eq('joined') - expect(last_event['project_id'].to_i).to eq(project.id) - expect(last_event['author_username']).to eq(user.username) - expect(last_event['author']['name']).to eq(user.name) + expect(joined_event['project_id'].to_i).to eq(project.id) + expect(joined_event['author_username']).to eq(user.username) + expect(joined_event['author']['name']).to eq(user.name) end end end |