Skip to content

Instantly share code, notes, and snippets.

@chrp
Created July 13, 2015 12:27
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 chrp/af0a713f353dbae1c326 to your computer and use it in GitHub Desktop.
Save chrp/af0a713f353dbae1c326 to your computer and use it in GitHub Desktop.
tiny demo to show when each callback kicks in around a rspec test
describe 'describe 1' do
before(:all) do
puts '1: before all'
end
before(:each) do
puts '1: before each'
end
after(:each) do
puts '1: after each'
end
after(:all) do
puts '1: after all'
end
it 'test1 ' do
puts '1: test 1'
end
it 'test2 ' do
puts '1: test 2'
end
context 'describe 2' do
before(:all) do
puts ' 2: before all'
end
before(:each) do
puts ' 2: before each'
end
after(:each) do
puts ' 2: after each'
end
after(:all) do
puts ' 2: after all'
end
it 'test1 ' do
puts ' 2: test 1'
end
it 'test2 ' do
puts ' 2: test 2'
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment