title: Testing an RSpec controller action that can't be accessed directly
body: <p>I've got a controller that can't be accessed directly, in the traditional RESTful way, but rather only through a particular url.</p>
  
  <p>Normally I'm used to using get and post in my controller specs to call controller actions.  Is there a way that I can exercise my controller by visiting a particular url?</p>
  
  <p>EDIT:</p>
  
  <p>Here is my route:</p>
  
  <pre><code>Larzworld::Application.routes.draw do
  
    match '/auth/:provider/callback' =&gt; 'authentications#create'
  
    devise_for :users, :controllers =&gt; {:registrations =&gt; "registrations"} 
  
    root :to =&gt; 'pages#home'
  end
  </code></pre>
  
  <p>Here is my spec:</p>
  
  <pre><code>require 'spec_helper'
  
  describe AuthenticationsController do
  
  before(:each) do
    request.env["omniauth.auth"] = {"provider" =&gt; "twitter", "uid" =&gt; "12345678"} 
  end
  
  describe 'POST create' do
  
    it "should find the Authentication using the uid and provider from omniauth" do
      Authentication.should_receive(:find_by_provider_and_uid)
      post 'auth/twitter/callback'
    end
  end
  
  end
  </code></pre>
  
  <p>and here is the error I receive:</p>
  
  <pre><code>Failures:
    1) AuthenticationsController POST create should find the Authentication using the uid and provider from omniauth
      Failure/Error: post 'auth/twitter/callback'
      No route matches {:action=&gt;"auth/twitter/callback", :controller=&gt;"authentications"}
      # ./spec/controllers/authentications_controller_spec.rb:13
  
  Finished in 0.04878 seconds
  1 example, 1 failure
  </code></pre>