Skip to content

Instantly share code, notes, and snippets.

@paul
Created October 24, 2008 23:15
Show Gist options
  • Save paul/19623 to your computer and use it in GitHub Desktop.
Save paul/19623 to your computer and use it in GitHub Desktop.
require File.join(File.dirname(__FILE__), 'spec_helper.rb')
given 'a given' do
puts 'Given'
end
describe 'a spec' do
before do
puts 'Outer Before'
end
describe 'a sub-example', :given => 'a given' do
before do
puts 'Inner Before'
end
it 'should have a broken-ass order' do
puts 'Example'
end
end
end
# OUTPUT:
# % rubyee ./bin/spec -O spec/spec.opts spec/given_order_spec.rb
# Outer Before
# Given
# Inner Before
# Example
# .
given 'one type of object exists' do; end
given 'a different type of object exists' do; end
describe 'my action' do
before do
@reponse = request('/my_action')
end
describe 'one type', :given => 'one type of object exists' do
it 'should have the response object here that contains one type of object' do
'but it does not, because the #request was performed before the :given'
end
end
describe 'a different type', :given => 'a different type of object exists' do
it 'should have the response object here that contains a different type of object'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment