diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2016-08-05 19:28:34 -0500 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2016-08-05 19:28:34 -0500 |
commit | 54a81ed3f58108ecbb6bf0c4945e1d4316e04f85 (patch) | |
tree | 054fb90e47829a1d3862119eab4c819404c69134 /spec/support/artifice | |
parent | 65d314bb9bc34677fed24ec750087ee0309f7431 (diff) | |
download | bundler-54a81ed3f58108ecbb6bf0c4945e1d4316e04f85.tar.gz |
Add specs for allow_offline_install
Diffstat (limited to 'spec/support/artifice')
-rw-r--r-- | spec/support/artifice/fail.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/support/artifice/fail.rb b/spec/support/artifice/fail.rb new file mode 100644 index 0000000000..9443d953e1 --- /dev/null +++ b/spec/support/artifice/fail.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +require File.expand_path("../../path.rb", __FILE__) + +# Set up pretend http gem server with FakeWeb +$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 +$LOAD_PATH.unshift Dir[Spec::Path.base_system_gems.join("gems/tilt*/lib")].first.to_s +require "artifice" + +class Fail + def call(env) + raise(exception(env)) + end + + def exception(env) + Object.const_get(ENV.fetch("BUNDLER_SPEC_EXCEPTION") { "Errno::ENETUNREACH" }).new("host down: Bundler spec artifice fail! #{env["PATH_INFO"]}") + end +end +Artifice.activate_with(Fail.new) |