Commit 46ef4954 authored by Thong Kuah's avatar Thong Kuah Committed by Douglas Barbosa Alexandre

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
parent 18e3dcc6
...@@ -388,7 +388,6 @@ group :test do ...@@ -388,7 +388,6 @@ group :test do
gem 'json-schema', '~> 2.8.0' gem 'json-schema', '~> 2.8.0'
gem 'webmock', '~> 3.5.1' gem 'webmock', '~> 3.5.1'
gem 'rails-controller-testing' gem 'rails-controller-testing'
gem 'sham_rack', '~> 1.3.6'
gem 'concurrent-ruby', '~> 1.1' gem 'concurrent-ruby', '~> 1.1'
gem 'test-prof', '~> 0.2.5' gem 'test-prof', '~> 0.2.5'
gem 'rspec_junit_formatter' gem 'rspec_junit_formatter'
......
...@@ -884,8 +884,6 @@ GEM ...@@ -884,8 +884,6 @@ GEM
faraday (>= 0.7.6, < 1.0) faraday (>= 0.7.6, < 1.0)
settingslogic (2.0.9) settingslogic (2.0.9)
sexp_processor (4.12.0) sexp_processor (4.12.0)
sham_rack (1.3.6)
rack
shoulda-matchers (4.0.1) shoulda-matchers (4.0.1)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
sidekiq (5.2.7) sidekiq (5.2.7)
...@@ -1232,7 +1230,6 @@ DEPENDENCIES ...@@ -1232,7 +1230,6 @@ DEPENDENCIES
selenium-webdriver (~> 3.141) selenium-webdriver (~> 3.141)
sentry-raven (~> 2.9) sentry-raven (~> 2.9)
settingslogic (~> 2.0.9) settingslogic (~> 2.0.9)
sham_rack (~> 1.3.6)
shoulda-matchers (~> 4.0.1) shoulda-matchers (~> 4.0.1)
sidekiq (~> 5.2.7) sidekiq (~> 5.2.7)
sidekiq-cron (~> 1.0) sidekiq-cron (~> 1.0)
......
...@@ -116,7 +116,7 @@ describe ContainerRegistry::Blob do ...@@ -116,7 +116,7 @@ describe ContainerRegistry::Blob do
let(:location) { 'file:///etc/passwd' } let(:location) { 'file:///etc/passwd' }
it 'raises an error' do 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 end
end end
......
...@@ -20,13 +20,8 @@ describe Projects::DownloadService do ...@@ -20,13 +20,8 @@ describe Projects::DownloadService do
context 'for URLs that are on the whitelist' do context 'for URLs that are on the whitelist' do
before do before do
sham_rack_app = ShamRack.at('mycompany.fogbugz.com').stub stub_request(:get, 'http://mycompany.fogbugz.com/rails_sample.jpg').to_return(body: File.read(Rails.root + 'spec/fixtures/rails_sample.jpg'))
sham_rack_app.register_resource('/rails_sample.jpg', File.read(Rails.root + 'spec/fixtures/rails_sample.jpg'), 'image/jpg') stub_request(:get, 'http://mycompany.fogbugz.com/doc_sample.txt').to_return(body: File.read(Rails.root + 'spec/fixtures/doc_sample.txt'))
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
end end
context 'an image file' do context 'an image file' do
......
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