Created
September 15, 2012 18:11
-
-
Save epitron/3729125 to your computer and use it in GitHub Desktop.
How to use pry-rescue in your specs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spork' | |
Spork.prefork do | |
require 'rspec' | |
require 'pry' | |
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration | |
RSpec.configure do |config| | |
config.treat_symbols_as_metadata_keys_with_true_values = true | |
config.run_all_when_everything_filtered = true | |
config.filter_run :focus | |
config.order = 'random' # Affect with --seed 1234 | |
# This will probably be upstreamed into pry-rescue at some point | |
config.around :each do |example| | |
Pry::rescue do | |
example.binding.eval '@exception = nil' | |
example.run | |
if (e = example.binding.eval '@exception') | |
Pry::rescued e | |
end | |
end | |
end | |
end | |
end | |
Spork.each_run do | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment