Skip to content

Instantly share code, notes, and snippets.

@gongo
Created March 12, 2016 10: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 gongo/97eda04fbb4cd01cbd73 to your computer and use it in GitHub Desktop.
Save gongo/97eda04fbb4cd01cbd73 to your computer and use it in GitHub Desktop.
[Turnip Example] hook to after scenario step https://groups.google.com/forum/#!topic/ruby-turnip/WRD0WXqQsYc
$ bundle install --path vendor/bundle
$ bundle exec rspec
"background when"
"background then"
"scenario1 when"
"scenario1 then"
"after step"
."background when"
"background then"
"scenario2 when"
"scenario2 then"
"after step"
.
Finished in 0.00341 seconds (files took 0.14205 seconds to load)
2 examples, 0 failures
|-- Gemfile
|-- Gemfile.lock
`-- spec
|-- features
| `-- example.feature
|-- spec_helper.rb
`-- steps
`-- example_steps.rb
Feature: Example
Background:
When text is "background when"
When text is "background then"
Scenario: scenario1
When text is "scenario1 when"
Then text is "scenario1 then"
Scenario: scenario1
When text is "scenario2 when"
Then text is "scenario2 then"
step 'text is :text' do |text|
p text
end
source "https://rubygems.org"
gem "turnip"
gem 'rspec'
Dir.glob("spec/steps/**/*steps.rb") { |f| load f, true }
RSpec.configure do |config|
config.after type: :feature do
p 'after step'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment