Created
November 29, 2011 19:59
-
-
Save bionicpill/1406206 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec/spec_helper' | |
describe AuthenticatedSystem do | |
class TestClass < ApplicationController | |
include AuthenticatedSystem | |
def initialize(user) | |
@user = user | |
end | |
def session | |
{ :user => @user.id } | |
end | |
end | |
describe '#logged_in?' do | |
describe 'user id is in the session' do | |
it 'returns true if user is in the database' do | |
user = users :joe | |
User.stubs(:find_by_id).returns(user) | |
@auth_system = TestClass.new(user) | |
@auth_system.send(:logged_in?).should be_true | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment