You probably know about the possibility to tag scenarios in Cucumber to run your own piece of code before the actual scenario is run which looks like that:
@foo
Scenario: Do something
...
and you place the following snippet into support/env.rb
:
Before('@foo') do
puts "This is run every time a @foo tagged scenario is hit"
end
You can tag RSpec examples like this:
it 'does something', :foo => true do
...
end
What you need is the following within the RSpec.configure do |config|
block within spec_helper.rb
config.before(:each, :foo => true) do
puts "This is run every time a tagged rspec example is hit"
end
Posted by Thomas Eisenbarth to makandra dev (2012-02-21 16:46)