Commit 390d6263 authored by Igor Drozdov's avatar Igor Drozdov

Merge branch 'sh-fix-kwargs-git-http-spec' into 'master'

Fix Ruby 2.7 deprecation warnings in ee/spec/requests/git_http_spec.rb

See merge request gitlab-org/gitlab!43496
parents 1036b045 61b443f6
...@@ -8,7 +8,7 @@ RSpec.describe 'Git HTTP requests' do ...@@ -8,7 +8,7 @@ RSpec.describe 'Git HTTP requests' do
shared_examples_for 'pulls are allowed' do shared_examples_for 'pulls are allowed' do
specify do specify do
download(path, env) do |response| download(path, **env) do |response|
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.media_type).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE) expect(response.media_type).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
end end
...@@ -17,7 +17,7 @@ RSpec.describe 'Git HTTP requests' do ...@@ -17,7 +17,7 @@ RSpec.describe 'Git HTTP requests' do
shared_examples_for 'pushes are allowed' do shared_examples_for 'pushes are allowed' do
specify do specify do
upload(path, env) do |response| upload(path, **env) do |response|
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response.media_type).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE) expect(response.media_type).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
end end
...@@ -42,7 +42,7 @@ RSpec.describe 'Git HTTP requests' do ...@@ -42,7 +42,7 @@ RSpec.describe 'Git HTTP requests' do
end end
it "responds with status 401 Unauthorized" do it "responds with status 401 Unauthorized" do
download(path, env) do |response| download(path, **env) do |response|
expect(response).to have_gitlab_http_status(:unauthorized) expect(response).to have_gitlab_http_status(:unauthorized)
end end
end end
...@@ -54,7 +54,7 @@ RSpec.describe 'Git HTTP requests' do ...@@ -54,7 +54,7 @@ RSpec.describe 'Git HTTP requests' do
end end
it "responds with status 401 Unauthorized" do it "responds with status 401 Unauthorized" do
download(path, env) do |response| download(path, **env) do |response|
expect(response).to have_gitlab_http_status(:unauthorized) expect(response).to have_gitlab_http_status(:unauthorized)
end end
end end
...@@ -78,7 +78,7 @@ RSpec.describe 'Git HTTP requests' do ...@@ -78,7 +78,7 @@ RSpec.describe 'Git HTTP requests' do
end end
it "responds with status 403 Forbidden" do it "responds with status 403 Forbidden" do
download(path, env) do |response| download(path, **env) do |response|
expect(response).to have_gitlab_http_status(:forbidden) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
...@@ -86,7 +86,7 @@ RSpec.describe 'Git HTTP requests' do ...@@ -86,7 +86,7 @@ RSpec.describe 'Git HTTP requests' do
context "when the user isn't blocked", :redis do context "when the user isn't blocked", :redis do
it "responds with status 200 OK" do it "responds with status 200 OK" do
download(path, env) do |response| download(path, **env) do |response|
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -94,7 +94,7 @@ RSpec.describe 'Git HTTP requests' do ...@@ -94,7 +94,7 @@ RSpec.describe 'Git HTTP requests' do
it 'updates the user last activity' do it 'updates the user last activity' do
expect(user.last_activity_on).to be_nil expect(user.last_activity_on).to be_nil
download(path, env) do |_response| download(path, **env) do |_response|
expect(user.reload.last_activity_on).to eql(Date.today) expect(user.reload.last_activity_on).to eql(Date.today)
end end
end end
...@@ -102,7 +102,7 @@ RSpec.describe 'Git HTTP requests' do ...@@ -102,7 +102,7 @@ RSpec.describe 'Git HTTP requests' do
it "complies with RFC4559" do it "complies with RFC4559" do
allow_any_instance_of(Repositories::GitHttpController).to receive(:spnego_response_token).and_return("opaque_response_token") allow_any_instance_of(Repositories::GitHttpController).to receive(:spnego_response_token).and_return("opaque_response_token")
download(path, env) do |response| download(path, **env) do |response|
expect(response.headers['WWW-Authenticate'].split("\n")).to include("Negotiate #{::Base64.strict_encode64('opaque_response_token')}") expect(response.headers['WWW-Authenticate'].split("\n")).to include("Negotiate #{::Base64.strict_encode64('opaque_response_token')}")
end end
end end
...@@ -110,14 +110,14 @@ RSpec.describe 'Git HTTP requests' do ...@@ -110,14 +110,14 @@ RSpec.describe 'Git HTTP requests' do
context "when the user doesn't have access to the project" do context "when the user doesn't have access to the project" do
it "responds with status 404 Not Found" do it "responds with status 404 Not Found" do
download(path, env) do |response| download(path, **env) do |response|
expect(response).to have_gitlab_http_status(:not_found) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
it "complies with RFC4559" do it "complies with RFC4559" do
allow_any_instance_of(Repositories::GitHttpController).to receive(:spnego_response_token).and_return("opaque_response_token") allow_any_instance_of(Repositories::GitHttpController).to receive(:spnego_response_token).and_return("opaque_response_token")
download(path, env) do |response| download(path, **env) do |response|
expect(response.headers['WWW-Authenticate'].split("\n")).to include("Negotiate #{::Base64.strict_encode64('opaque_response_token')}") expect(response.headers['WWW-Authenticate'].split("\n")).to include("Negotiate #{::Base64.strict_encode64('opaque_response_token')}")
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