Skip to content

Instantly share code, notes, and snippets.

@bionicpill
Created November 29, 2011 19:59
Show Gist options
  • Save bionicpill/1406206 to your computer and use it in GitHub Desktop.
Save bionicpill/1406206 to your computer and use it in GitHub Desktop.
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