Skip to content

Instantly share code, notes, and snippets.

@jrochkind
Last active June 8, 2016 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrochkind/04725b9f864d0cdedd7c8a7474cdd183 to your computer and use it in GitHub Desktop.
Save jrochkind/04725b9f864d0cdedd7c8a7474cdd183 to your computer and use it in GitHub Desktop.
require 'rspec'
require 'rspec/autorun'
describe "foo" do
around do |example|
puts "This is before #{example.description}"
example.run
puts "This is after #{example.description}"
end
it "passes" do
expect(true).to be true
end
it "raises" do
raise "uh oh!"
end
end
@jrochkind
Copy link
Author

$ ruby test.rb
This is before passes
This is after passes
.This is before raises
This is after raises
F

Failures:

  1. foo raises
    Failure/Error: raise "uh oh!"
 RuntimeError:
   uh oh!
 # test.rb:18:in `block (2 levels) in <main>'
 # test.rb:8:in `block (2 levels) in <main>'

Finished in 0.0019 seconds (files took 0.14316 seconds to load)
2 examples, 1 failure

Failed examples:

rspec test.rb:17 # foo raises

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment