diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/install/gemfile/platform_spec.rb | 2 | ||||
-rw-r--r-- | spec/install/gems/compact_index_spec.rb | 2 | ||||
-rw-r--r-- | spec/install/gems/dependency_api_spec.rb | 2 | ||||
-rw-r--r-- | spec/spec_helper.rb | 2 | ||||
-rw-r--r-- | spec/support/artifice/endpoint.rb | 2 | ||||
-rw-r--r-- | spec/support/artifice/fail.rb | 2 | ||||
-rw-r--r-- | spec/support/artifice/windows.rb | 48 | ||||
-rw-r--r-- | spec/support/fakeweb/rack-1.0.0.marshal | 2 | ||||
-rw-r--r-- | spec/support/fakeweb/windows.rb | 27 | ||||
-rw-r--r-- | spec/support/helpers.rb | 2 | ||||
-rw-r--r-- | spec/support/rubygems_ext.rb | 2 |
11 files changed, 55 insertions, 38 deletions
diff --git a/spec/install/gemfile/platform_spec.rb b/spec/install/gemfile/platform_spec.rb index 9caa0b5731..ebf69f4006 100644 --- a/spec/install/gemfile/platform_spec.rb +++ b/spec/install/gemfile/platform_spec.rb @@ -233,7 +233,7 @@ describe "when a gem has no architecture" do gem "rcov" G - bundle :install, :fakeweb => "windows" + bundle :install, :artifice => "windows" expect(the_bundle).to include_gems "rcov 1.0.0" end end diff --git a/spec/install/gems/compact_index_spec.rb b/spec/install/gems/compact_index_spec.rb index 001118b513..8cca7690c9 100644 --- a/spec/install/gems/compact_index_spec.rb +++ b/spec/install/gems/compact_index_spec.rb @@ -144,7 +144,7 @@ describe "compact index api" do gem "rcov" G - bundle! :install, :fakeweb => "windows" + bundle! :install, :artifice => "windows" expect(out).to include("Fetching source index from #{source_uri}") expect(the_bundle).to include_gems "rcov 1.0.0" end diff --git a/spec/install/gems/dependency_api_spec.rb b/spec/install/gems/dependency_api_spec.rb index a7c1aedea3..9d5b740007 100644 --- a/spec/install/gems/dependency_api_spec.rb +++ b/spec/install/gems/dependency_api_spec.rb @@ -124,7 +124,7 @@ describe "gemcutter's dependency API" do gem "rcov" G - bundle :install, :fakeweb => "windows" + bundle :install, :artifice => "windows" expect(out).to include("Fetching source index from #{source_uri}") expect(the_bundle).to include_gems "rcov 1.0.0" end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 642bfabc18..5574c4ae3b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -35,7 +35,7 @@ else end Dir["#{File.expand_path("../support", __FILE__)}/*.rb"].each do |file| - require file unless file =~ %r{fakeweb/.*\.rb} + require file unless file.end_with?("hax.rb") end $debug = false diff --git a/spec/support/artifice/endpoint.rb b/spec/support/artifice/endpoint.rb index 99ffac1c11..fae72ea4cd 100644 --- a/spec/support/artifice/endpoint.rb +++ b/spec/support/artifice/endpoint.rb @@ -3,7 +3,7 @@ require File.expand_path("../../path.rb", __FILE__) require File.expand_path("../../../../lib/bundler/deprecate", __FILE__) include Spec::Path -# Set up pretend http gem server with FakeWeb +# Set up pretend http gem server with Artifice $LOAD_PATH.unshift "#{Dir[base_system_gems.join("gems/artifice*/lib")].first}" $LOAD_PATH.unshift "#{Dir[base_system_gems.join("gems/rack-*/lib")].first}" $LOAD_PATH.unshift "#{Dir[base_system_gems.join("gems/rack-*/lib")].last}" diff --git a/spec/support/artifice/fail.rb b/spec/support/artifice/fail.rb index e15768a328..2e29c03c5b 100644 --- a/spec/support/artifice/fail.rb +++ b/spec/support/artifice/fail.rb @@ -2,7 +2,7 @@ require File.expand_path("../../path.rb", __FILE__) -# Set up pretend http gem server with FakeWeb +# Set up pretend http gem server with Artifice $LOAD_PATH.unshift Dir[Spec::Path.base_system_gems.join("gems/artifice*/lib")].first.to_s $LOAD_PATH.unshift Dir[Spec::Path.base_system_gems.join("gems/rack-*/lib")].first.to_s $LOAD_PATH.unshift Dir[Spec::Path.base_system_gems.join("gems/rack-*/lib")].last.to_s diff --git a/spec/support/artifice/windows.rb b/spec/support/artifice/windows.rb new file mode 100644 index 0000000000..c18ca454ec --- /dev/null +++ b/spec/support/artifice/windows.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true +require File.expand_path("../../path.rb", __FILE__) +include Spec::Path + +$LOAD_PATH.unshift Dir[base_system_gems.join("gems/artifice*/lib")].first.to_s +$LOAD_PATH.unshift(*Dir[base_system_gems.join("gems/rack-*/lib")]) +$LOAD_PATH.unshift Dir[base_system_gems.join("gems/tilt*/lib")].first.to_s +$LOAD_PATH.unshift Dir[base_system_gems.join("gems/sinatra*/lib")].first.to_s +require "artifice" +require "sinatra/base" + +Artifice.deactivate + +class Windows < Sinatra::Base + set :raise_errors, true + set :show_exceptions, false + + helpers do + def gem_repo + Pathname.new(ENV["BUNDLER_SPEC_GEM_REPO"] || Spec::Path.gem_repo1) + end + end + + files = ["specs.4.8.gz", + "prerelease_specs.4.8.gz", + "quick/Marshal.4.8/rcov-1.0-mswin32.gemspec.rz", + "gems/rcov-1.0-mswin32.gem"] + + files.each do |file| + get "/#{file}" do + File.read gem_repo.join(file) + end + end + + get "/gems/rcov-1.0-x86-mswin32.gem" do + halt 404 + end + + get "/api/v1/dependencies" do + halt 404 + end + + get "/versions" do + halt 500 + end +end + +Artifice.activate_with(Windows) diff --git a/spec/support/fakeweb/rack-1.0.0.marshal b/spec/support/fakeweb/rack-1.0.0.marshal deleted file mode 100644 index 383ce407f9..0000000000 --- a/spec/support/fakeweb/rack-1.0.0.marshal +++ /dev/null @@ -1,2 +0,0 @@ -[{ :dependencies[[" thin" >= 0["ruby-openid"
~> 2.0.0["mongrel" >= 0["memcache-client" >= 0[" fcgi" >= 0["camping" >= 0["test-spec" >= 0:
platform" ruby: name" rack:number" -1.0.0
\ No newline at end of file diff --git a/spec/support/fakeweb/windows.rb b/spec/support/fakeweb/windows.rb deleted file mode 100644 index f1f21eed3f..0000000000 --- a/spec/support/fakeweb/windows.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true -require File.expand_path("../../path.rb", __FILE__) -include Spec::Path - -files = ["specs.4.8.gz", - "prerelease_specs.4.8.gz", - "quick/Marshal.4.8/rcov-1.0-mswin32.gemspec.rz", - "gems/rcov-1.0-mswin32.gem"] - -# Set up pretend http gem server with FakeWeb -$LOAD_PATH.unshift "#{Dir[base_system_gems.join("gems/fakeweb*/lib")].first}" -require "fakeweb" - -FakeWeb.allow_net_connect = false - -files.each do |file| - FakeWeb.register_uri(:get, "http://localgemserver.test/#{file}", - :body => File.read("#{gem_repo1}/#{file}")) -end -FakeWeb.register_uri(:get, "http://localgemserver.test/gems/rcov-1.0-x86-mswin32.gem", - :status => ["404", "Not Found"]) - -FakeWeb.register_uri(:get, "http://localgemserver.test/api/v1/dependencies", - :status => ["404", "Not Found"]) - -FakeWeb.register_uri(:get, "http://localgemserver.test/versions", - :status => ["500", "Internal Server Error"]) diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index 6b30afd480..3ec5d368b9 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -93,7 +93,6 @@ module Spec end requires = options.delete(:requires) || [] - requires << File.expand_path("../fakeweb/" + options.delete(:fakeweb) + ".rb", __FILE__) if options.key?(:fakeweb) requires << File.expand_path("../artifice/" + options.delete(:artifice) + ".rb", __FILE__) if options.key?(:artifice) requires << "support/hax" requires_str = requires.map {|r| "-r#{r}" }.join(" ") @@ -125,7 +124,6 @@ module Spec bundle_bin = File.expand_path("../../../exe/bundle_ruby", __FILE__) requires = options.delete(:requires) || [] - requires << File.expand_path("../fakeweb/" + options.delete(:fakeweb) + ".rb", __FILE__) if options.key?(:fakeweb) requires << File.expand_path("../artifice/" + options.delete(:artifice) + ".rb", __FILE__) if options.key?(:artifice) requires_str = requires.map {|r| "-r#{r}" }.join(" ") diff --git a/spec/support/rubygems_ext.rb b/spec/support/rubygems_ext.rb index e2b8c6a45e..f20e051d1d 100644 --- a/spec/support/rubygems_ext.rb +++ b/spec/support/rubygems_ext.rb @@ -9,7 +9,7 @@ module Spec # rack 2.x requires Ruby version >= 2.2.2. # artifice doesn't support rack 2.x now. "rack" => "< 2", - "fakeweb artifice" => nil, + "artifice" => "~> 0.6.0", "compact_index" => "~> 0.11.0", "sinatra" => "1.2.7", # Rake version has to be consistent for tests to pass |