Skip to content

Instantly share code, notes, and snippets.

@thechrisoshow
Created March 5, 2012 14:25
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save thechrisoshow/1978521 to your computer and use it in GitHub Desktop.
Use of anonymous controller in rspec tests
require 'spec_helper'
describe ApplicationController do
describe "current_user" do
controller do
before_filter :authorize
def index
end
end
it "can login with login_token" do
user = Factory(:user, :login_token => "banana", :login_expires => Date.today + 1.week)
get :index, :login_token => "banana"
controller.current_user.should == user
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment