summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThong Kuah <tkuah@gitlab.com>2019-07-24 14:46:37 +1200
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2019-07-29 19:20:27 -0300
commit46ef495488d46932b18353739342d503288e0eea (patch)
tree7938f09bbce9a5d603739b952bfffe20da7995d6
parent18e3dcc65e399642918e9a7a90fcafd391a1038d (diff)
downloadgitlab-ce-46ef495488d46932b18353739342d503288e0eea.tar.gz
Write out sham_rack gem
This means we have one less Net::HTTP monkeypatch. sham_rack cannot handle IPv6 addresses which means it breaks Net::HTTP connections because it monkey-patches Net::HTTP
-rw-r--r--Gemfile1
-rw-r--r--Gemfile.lock3
-rw-r--r--spec/lib/container_registry/blob_spec.rb2
-rw-r--r--spec/services/projects/download_service_spec.rb9
4 files changed, 3 insertions, 12 deletions
diff --git a/Gemfile b/Gemfile
index e860ee61cb9..2d2ce8185aa 100644
--- a/Gemfile
+++ b/Gemfile
@@ -388,7 +388,6 @@ group :test do
gem 'json-schema', '~> 2.8.0'
gem 'webmock', '~> 3.5.1'
gem 'rails-controller-testing'
- gem 'sham_rack', '~> 1.3.6'
gem 'concurrent-ruby', '~> 1.1'
gem 'test-prof', '~> 0.2.5'
gem 'rspec_junit_formatter'
diff --git a/Gemfile.lock b/Gemfile.lock
index 3614f111a4b..f7776b296da 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -884,8 +884,6 @@ GEM
faraday (>= 0.7.6, < 1.0)
settingslogic (2.0.9)
sexp_processor (4.12.0)
- sham_rack (1.3.6)
- rack
shoulda-matchers (4.0.1)
activesupport (>= 4.2.0)
sidekiq (5.2.7)
@@ -1232,7 +1230,6 @@ DEPENDENCIES
selenium-webdriver (~> 3.141)
sentry-raven (~> 2.9)
settingslogic (~> 2.0.9)
- sham_rack (~> 1.3.6)
shoulda-matchers (~> 4.0.1)
sidekiq (~> 5.2.7)
sidekiq-cron (~> 1.0)
diff --git a/spec/lib/container_registry/blob_spec.rb b/spec/lib/container_registry/blob_spec.rb
index ba7f76cfa3b..ec5addc7c68 100644
--- a/spec/lib/container_registry/blob_spec.rb
+++ b/spec/lib/container_registry/blob_spec.rb
@@ -116,7 +116,7 @@ describe ContainerRegistry::Blob do
let(:location) { 'file:///etc/passwd' }
it 'raises an error' do
- expect { blob.data }.to raise_error(ArgumentError, 'invalid address')
+ expect { blob.data }.to raise_error(NoMethodError, %q{undefined method `request_uri' for #<URI::File file:///etc/passwd>})
end
end
end
diff --git a/spec/services/projects/download_service_spec.rb b/spec/services/projects/download_service_spec.rb
index f25233ceeb1..06efc2ff825 100644
--- a/spec/services/projects/download_service_spec.rb
+++ b/spec/services/projects/download_service_spec.rb
@@ -20,13 +20,8 @@ describe Projects::DownloadService do
context 'for URLs that are on the whitelist' do
before do
- sham_rack_app = ShamRack.at('mycompany.fogbugz.com').stub
- sham_rack_app.register_resource('/rails_sample.jpg', File.read(Rails.root + 'spec/fixtures/rails_sample.jpg'), 'image/jpg')
- sham_rack_app.register_resource('/doc_sample.txt', File.read(Rails.root + 'spec/fixtures/doc_sample.txt'), 'text/plain')
- end
-
- after do
- ShamRack.unmount_all
+ stub_request(:get, 'http://mycompany.fogbugz.com/rails_sample.jpg').to_return(body: File.read(Rails.root + 'spec/fixtures/rails_sample.jpg'))
+ stub_request(:get, 'http://mycompany.fogbugz.com/doc_sample.txt').to_return(body: File.read(Rails.root + 'spec/fixtures/doc_sample.txt'))
end
context 'an image file' do