From 2f40dac35280f9de9af8c47bdf85c2f0b2d53680 Mon Sep 17 00:00:00 2001 From: Jacopo Date: Thu, 19 Oct 2017 20:28:19 +0200 Subject: Refactor `have_http_status` into `have_gitlab_http_status` in the specs --- spec/requests/api/v3/project_snippets_spec.rb | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'spec/requests/api/v3/project_snippets_spec.rb') diff --git a/spec/requests/api/v3/project_snippets_spec.rb b/spec/requests/api/v3/project_snippets_spec.rb index 7e88489082a..2ed31b99516 100644 --- a/spec/requests/api/v3/project_snippets_spec.rb +++ b/spec/requests/api/v3/project_snippets_spec.rb @@ -28,7 +28,7 @@ describe API::ProjectSnippets do get v3_api("/projects/#{project.id}/snippets/", user) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response.size).to eq(3) expect(json_response.map { |snippet| snippet['id']} ).to include(public_snippet.id, internal_snippet.id, private_snippet.id) expect(json_response.last).to have_key('web_url') @@ -38,7 +38,7 @@ describe API::ProjectSnippets do create(:project_snippet, :private, project: project) get v3_api("/projects/#{project.id}/snippets/", user) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(json_response.size).to eq(0) end end @@ -56,7 +56,7 @@ describe API::ProjectSnippets do it 'creates a new snippet' do post v3_api("/projects/#{project.id}/snippets/", admin), params - expect(response).to have_http_status(201) + expect(response).to have_gitlab_http_status(201) snippet = ProjectSnippet.find(json_response['id']) expect(snippet.content).to eq(params[:code]) expect(snippet.title).to eq(params[:title]) @@ -69,7 +69,7 @@ describe API::ProjectSnippets do post v3_api("/projects/#{project.id}/snippets/", admin), params - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) end context 'when the snippet is spam' do @@ -95,7 +95,7 @@ describe API::ProjectSnippets do expect { create_snippet(project, visibility_level: Snippet::PUBLIC) } .not_to change { Snippet.count } - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) expect(json_response['message']).to eq({ "error" => "Spam detected" }) end @@ -116,7 +116,7 @@ describe API::ProjectSnippets do put v3_api("/projects/#{snippet.project.id}/snippets/#{snippet.id}/", admin), code: new_content - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) snippet.reload expect(snippet.content).to eq(new_content) end @@ -124,14 +124,14 @@ describe API::ProjectSnippets do it 'returns 404 for invalid snippet id' do put v3_api("/projects/#{snippet.project.id}/snippets/1234", admin), title: 'foo' - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) expect(json_response['message']).to eq('404 Snippet Not Found') end it 'returns 400 for missing parameters' do put v3_api("/projects/#{project.id}/snippets/1234", admin) - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) end context 'when the snippet is spam' do @@ -173,7 +173,7 @@ describe API::ProjectSnippets do expect { update_snippet(title: 'Foo', visibility_level: Snippet::PUBLIC) } .not_to change { snippet.reload.title } - expect(response).to have_http_status(400) + expect(response).to have_gitlab_http_status(400) expect(json_response['message']).to eq({ "error" => "Spam detected" }) end @@ -194,13 +194,13 @@ describe API::ProjectSnippets do delete v3_api("/projects/#{snippet.project.id}/snippets/#{snippet.id}/", admin) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) end it 'returns 404 for invalid snippet id' do delete v3_api("/projects/#{snippet.project.id}/snippets/1234", admin) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) expect(json_response['message']).to eq('404 Snippet Not Found') end end @@ -211,7 +211,7 @@ describe API::ProjectSnippets do it 'returns raw text' do get v3_api("/projects/#{snippet.project.id}/snippets/#{snippet.id}/raw", admin) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(200) expect(response.content_type).to eq 'text/plain' expect(response.body).to eq(snippet.content) end @@ -219,7 +219,7 @@ describe API::ProjectSnippets do it 'returns 404 for invalid snippet id' do delete v3_api("/projects/#{snippet.project.id}/snippets/1234", admin) - expect(response).to have_http_status(404) + expect(response).to have_gitlab_http_status(404) expect(json_response['message']).to eq('404 Snippet Not Found') end end -- cgit v1.2.1