2012-11-24 11:36:47 -05:00
|
|
|
# Patch rspec to allow nested execution
|
|
|
|
module Rspec
|
|
|
|
# Run block in clean rspec environment
|
|
|
|
#
|
|
|
|
# @return [Object]
|
|
|
|
# returns the value of block
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
def self.nest
|
2013-04-17 23:31:21 -04:00
|
|
|
original_world, original_configuration =
|
2012-11-24 11:36:47 -05:00
|
|
|
::RSpec.instance_variable_get(:@world),
|
|
|
|
::RSpec.instance_variable_get(:@configuration)
|
|
|
|
|
|
|
|
::RSpec.reset
|
|
|
|
|
|
|
|
yield
|
|
|
|
ensure
|
|
|
|
::RSpec.instance_variable_set(:@world, original_world)
|
|
|
|
::RSpec.instance_variable_set(:@configuration, original_configuration)
|
|
|
|
end
|
|
|
|
end
|