I want to output a screen shot of the page after a failed scenario.
I'm using capybara, rspec and launchy - my gemfile has
group :development, :test do
gem 'rspec-rails'
gem 'capybara'
gem 'launchy'
end
I've seen various suggestions which include the following code
After do |scenario|
save_and_open_page if scenario.failed?
end
So, I've created a spec\support\env.rb file into which I've put this code (and that is all, there is nothing else in that file). Now when I run
bundle exec rspec
I get
C:/Working/x/spec/support/env.rb:1:in `<top (required)>': undefined method `After' for main:Object (NoMethodError)
If I comment out the lines in env.rb, then the tests run as I'd expect.
What am I missing?
Thanks
Versions:
- rails 4
- rspec 2.14.1
- capybara 2.1.0
- launchy 2.3.0