mirror of
https://github.com/thoughtbot/shoulda-matchers.git
synced 2022-11-09 12:01:38 -05:00
Zeus: Wrap Gem::LoadError in more informative error
This commit is contained in:
parent
f1da108dd1
commit
88a47e50ce
1 changed files with 23 additions and 7 deletions
|
@ -1,12 +1,27 @@
|
||||||
require 'zeus/rails'
|
require 'zeus'
|
||||||
|
require 'zeus/plan'
|
||||||
require_relative 'spec/support/tests/current_bundle'
|
require_relative 'spec/support/tests/current_bundle'
|
||||||
|
|
||||||
class CustomPlan < Zeus::Plan
|
class CouldNotBootZeusError < StandardError
|
||||||
def initialize
|
def self.create(underlying_error:)
|
||||||
super
|
new(<<-MESSAGE)
|
||||||
@rails_plan = Zeus::Rails.new
|
Couldn't boot Zeus.
|
||||||
end
|
|
||||||
|
|
||||||
|
Bundler tried to load a gem that has already been loaded (but the
|
||||||
|
versions are different).
|
||||||
|
|
||||||
|
Note that Appraisal requires Rake, and so you'll want to make sure that
|
||||||
|
the Gemfile is pointing to the same version of Rake that you have
|
||||||
|
installed locally.
|
||||||
|
|
||||||
|
The original message is as follows:
|
||||||
|
|
||||||
|
#{underlying_error.message}
|
||||||
|
MESSAGE
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class CustomPlan < Zeus::Plan
|
||||||
def boot
|
def boot
|
||||||
ENV['BUNDLE_GEMFILE'] = File.expand_path(
|
ENV['BUNDLE_GEMFILE'] = File.expand_path(
|
||||||
"../gemfiles/#{latest_appraisal}.gemfile",
|
"../gemfiles/#{latest_appraisal}.gemfile",
|
||||||
|
@ -19,10 +34,11 @@ class CustomPlan < Zeus::Plan
|
||||||
$LOAD_PATH << File.expand_path('../spec', __FILE__)
|
$LOAD_PATH << File.expand_path('../spec', __FILE__)
|
||||||
|
|
||||||
require_relative 'spec/support/unit/load_environment'
|
require_relative 'spec/support/unit/load_environment'
|
||||||
|
rescue Gem::LoadError => error
|
||||||
|
raise CouldNotBootZeusError.create(underlying_error: error)
|
||||||
end
|
end
|
||||||
|
|
||||||
def after_fork
|
def after_fork
|
||||||
# @rails_plan.reconnect_activerecord
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_environment
|
def test_environment
|
||||||
|
|
Loading…
Reference in a new issue