Skip to content

Instantly share code, notes, and snippets.

@epitron
Created September 15, 2012 18:11
Show Gist options
  • Save epitron/3729125 to your computer and use it in GitHub Desktop.
Save epitron/3729125 to your computer and use it in GitHub Desktop.
How to use pry-rescue in your specs.
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