title: After a Capybara failed scenario output screen shot
body: <p>I want to output a screen shot of the page after a failed scenario.</p>
  
  <p>I'm using capybara, rspec and launchy - my gemfile has</p>
  
  <pre><code>group :development, :test do
      gem 'rspec-rails'
      gem 'capybara'
      gem 'launchy'
  end 
  </code></pre>
  
  <p>I've seen various suggestions which include the following code</p>
  
  <pre><code>After do |scenario|
    save_and_open_page if scenario.failed?
  end
  </code></pre>
  
  <p>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 </p>
  
  <pre><code>bundle exec rspec
  </code></pre>
  
  <p>I get </p>
  
  <pre><code>C:/Working/x/spec/support/env.rb:1:in `&lt;top (required)&gt;': undefined method `After' for main:Object (NoMethodError)
  </code></pre>
  
  <p>If I comment out the lines in env.rb, then the tests run as I'd expect.</p>
  
  <p>What am I missing?</p>
  
  <p>Thanks</p>
  
  <p>Versions:</p>
  
  <ul>
  <li>rails 4</li>
  <li>rspec 2.14.1</li>
  <li>capybara 2.1.0</li>
  <li>launchy 2.3.0</li>
  </ul>