Skip to content

Instantly share code, notes, and snippets.

@wmoxam
Created July 19, 2012 18:14
Show Gist options
  • Save wmoxam/b3e3df9de255c28e7409 to your computer and use it in GitHub Desktop.
Save wmoxam/b3e3df9de255c28e7409 to your computer and use it in GitHub Desktop.
RSpec before woes
require 'spec_helper'
describe Organization do
before(:each) do
puts 'GLOBAL CONTEXT before block'
end
context 'context 1' do
before(:each) do
puts "context 1 before block"
end
it 'should print two before messages 1' do
puts "111111111111111111 'should print two before messages 1' 1111111111111111111111"
end
it 'should print two before messages 2' do
puts "111111111111111 'should print two before messages 2' 111111111111111111111"
end
end
context 'context 2' do
before(:each) do
puts "context 2 before block"
end
it 'should print two before messages 1' do
puts "22222222222222222 'should print two before messages 1' 22222222222222222"
end
it 'should print two before messages 2' do
puts "22222222222222222 'should print two before messages 2' 22222222222222222222"
end
end
end
GLOBAL CONTEXT before block
context 1 before block
context 2 before block
111111111111111111 'should print two before messages 1' 1111111111111111111111
.GLOBAL CONTEXT before block
context 1 before block
context 2 before block
111111111111111 'should print two before messages 2' 111111111111111111111
.GLOBAL CONTEXT before block
context 1 before block
context 2 before block
22222222222222222 'should print two before messages 1' 22222222222222222
.GLOBAL CONTEXT before block
context 1 before block
context 2 before block
22222222222222222 'should print two before messages 2' 22222222222222222222
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment