summaryrefslogtreecommitdiff
path: root/spec/support/artifice
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2016-08-05 19:28:34 -0500
committerSamuel Giddins <segiddins@segiddins.me>2016-08-05 19:28:34 -0500
commit54a81ed3f58108ecbb6bf0c4945e1d4316e04f85 (patch)
tree054fb90e47829a1d3862119eab4c819404c69134 /spec/support/artifice
parent65d314bb9bc34677fed24ec750087ee0309f7431 (diff)
downloadbundler-54a81ed3f58108ecbb6bf0c4945e1d4316e04f85.tar.gz
Add specs for allow_offline_install
Diffstat (limited to 'spec/support/artifice')
-rw-r--r--spec/support/artifice/fail.rb21
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)