diff options
author | Jacopo <beschi.jacopo@gmail.com> | 2017-10-19 20:28:19 +0200 |
---|---|---|
committer | Jacopo <beschi.jacopo@gmail.com> | 2017-10-20 10:13:18 +0200 |
commit | 2f40dac35280f9de9af8c47bdf85c2f0b2d53680 (patch) | |
tree | ece7f87f18b32c8961e784973caf1dd299e877c7 /spec/requests/api/broadcast_messages_spec.rb | |
parent | b4dc0ba2c57c150f847d255b0d2d831ff60728ad (diff) | |
download | gitlab-ce-2f40dac35280f9de9af8c47bdf85c2f0b2d53680.tar.gz |
Refactor `have_http_status` into `have_gitlab_http_status` in the specs
Diffstat (limited to 'spec/requests/api/broadcast_messages_spec.rb')
-rw-r--r-- | spec/requests/api/broadcast_messages_spec.rb | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/spec/requests/api/broadcast_messages_spec.rb b/spec/requests/api/broadcast_messages_spec.rb index eacc575d97f..fe8a14fae9e 100644 --- a/spec/requests/api/broadcast_messages_spec.rb +++ b/spec/requests/api/broadcast_messages_spec.rb @@ -9,13 +9,13 @@ describe API::BroadcastMessages do it 'returns a 401 for anonymous users' do get api('/broadcast_messages') - expect(response).to have_http_status(401) + expect(response).to have_gitlab_http_status(401) end it 'returns a 403 for users' do get api('/broadcast_messages', user) - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end it 'returns an Array of BroadcastMessages for admins' do @@ -23,7 +23,7 @@ describe API::BroadcastMessages do get api('/broadcast_messages', admin) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers expect(json_response).to be_kind_of(Array) expect(json_response.first.keys) @@ -35,19 +35,19 @@ describe API::BroadcastMessages do it 'returns a 401 for anonymous users' do get api("/broadcast_messages/#{message.id}") - expect(response).to have_http_status(401) + expect(response).to have_gitlab_http_status(401) end it 'returns a 403 for users' do get api("/broadcast_messages/#{message.id}", user) - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end it 'returns the specified message for admins' do get api("/broadcast_messages/#{message.id}", admin) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['id']).to eq message.id expect(json_response.keys) .to match_array(%w(id message starts_at ends_at color font active)) @@ -58,13 +58,13 @@ describe API::BroadcastMessages do it 'returns a 401 for anonymous users' do post api('/broadcast_messages'), attributes_for(:broadcast_message) - expect(response).to have_http_status(401) + expect(response).to have_gitlab_http_status(401) end it 'returns a 403 for users' do post api('/broadcast_messages', user), attributes_for(:broadcast_message) - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end context 'as an admin' do @@ -74,7 +74,7 @@ describe API::BroadcastMessages do post api('/broadcast_messages', admin), attrs - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) expect(json_response['error']).to eq 'message is missing' end @@ -83,7 +83,7 @@ describe API::BroadcastMessages do travel_to(time) do post api('/broadcast_messages', admin), message: 'Test message' - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) expect(json_response['starts_at']).to eq '2016-07-02T10:11:12.000Z' expect(json_response['ends_at']).to eq '2016-07-02T11:11:12.000Z' end @@ -94,7 +94,7 @@ describe API::BroadcastMessages do post api('/broadcast_messages', admin), attrs - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) expect(json_response['color']).to eq attrs[:color] expect(json_response['font']).to eq attrs[:font] end @@ -106,14 +106,14 @@ describe API::BroadcastMessages do put api("/broadcast_messages/#{message.id}"), attributes_for(:broadcast_message) - expect(response).to have_http_status(401) + expect(response).to have_gitlab_http_status(401) end it 'returns a 403 for users' do put api("/broadcast_messages/#{message.id}", user), attributes_for(:broadcast_message) - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end context 'as an admin' do @@ -122,7 +122,7 @@ describe API::BroadcastMessages do put api("/broadcast_messages/#{message.id}", admin), attrs - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['color']).to eq attrs[:color] expect(json_response['font']).to eq attrs[:font] end @@ -134,7 +134,7 @@ describe API::BroadcastMessages do put api("/broadcast_messages/#{message.id}", admin), attrs - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response['starts_at']).to eq '2016-07-02T10:11:12.000Z' expect(json_response['ends_at']).to eq '2016-07-02T13:11:12.000Z' end @@ -145,7 +145,7 @@ describe API::BroadcastMessages do put api("/broadcast_messages/#{message.id}", admin), attrs - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect { message.reload }.to change { message.message }.to('new message') end end @@ -156,14 +156,14 @@ describe API::BroadcastMessages do delete api("/broadcast_messages/#{message.id}"), attributes_for(:broadcast_message) - expect(response).to have_http_status(401) + expect(response).to have_gitlab_http_status(401) end it 'returns a 403 for users' do delete api("/broadcast_messages/#{message.id}", user), attributes_for(:broadcast_message) - expect(response).to have_http_status(403) + expect(response).to have_gitlab_http_status(403) end it_behaves_like '412 response' do @@ -174,7 +174,7 @@ describe API::BroadcastMessages do expect do delete api("/broadcast_messages/#{message.id}", admin) - expect(response).to have_http_status(204) + expect(response).to have_gitlab_http_status(204) end.to change { BroadcastMessage.count }.by(-1) end end |