title: Trying to test omniauth with rspec & Capybara, failing
body: <p>Using Rails 3.2 and the latest Rspec and Capybara, which means my Capybara specs live in <code>spec/features</code>.</p>
  
  <p>I'm really new to Rails and testing, but I want to get used to testing. I ended up implementing OAuth before testing it. I finally got it working, and now I'm trying to retroactively test it (so I at least know if it breaks in the future). I'm trying to follow <a href="http://blog.zerosum.org/2011/03/19/easy-rails-outh-integration-testing.html" rel="nofollow">this tutorial</a>, but things aren't working. Here's what I did:</p>
  
  <p>1) Created <code>spec/support/integration_spec_helper.rb</code> with:</p>
  
  <p><code>
  module IntegrationSpecHelper
    def login_with_oauth(service = :google)
      visit "/auth/#{service}"
    end
  end
  </code></p>
  
  <p>2) Modified <code>spec/spec_helper</code> to include <code>config.include IntegrationSpecHelper, :type =&gt; :request</code> inside the <code>Rspec.configure</code> do block.</p>
  
  <p>3) Created <code>spec/features/omniauth_spec.rb</code> with:</p>
  
  <pre><code>require 'spec_helper'
  feature 'testing oauth' do
    scenario 'should create a new tiger' do
      login_with_oauth
      visit new_tiger_path
  
      fill_in 'tiger_name', :with =&gt; 'Charlie'
      fill_in 'tiger_blood', :with =&gt; 'yes'
  
      click_on 'Create Tiger'
  
      page.should have_content("Thanks! You are a winner!")
    end
  end
  </code></pre>
  
  <p>Of course it's going to fail (I don't have tigers in my app) but I want it to fail on <code>visit new_tiger_path</code>. Instead, running the spec, I get:</p>
  
  <p><code>
    1) testing oauth should create a new tiger
       Failure/Error: login_with_oauth
       NameError:
         undefined local variable or method `login_with_oauth' for #&lt;RSpec::Core::ExampleGroup::Nested_3:0x83355d8&gt;
       # ./spec/features/omniauth_spec.rb:4:in `block (2 levels) in &lt;top (required)&gt;'
  </code></p>
  
  <p>So basically, it says there's no such thing <code>login_with_oauth</code>. This must be a really basic error, as my code isn't included for some reason.</p>
  
  <p>I'm not using spork (trying to keep things simple).</p>
  
  <p>Any idea what the problem might be? Thanks in advance!</p>