Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
- describe AuthenticationSystem do
- before :each do
- @auth = Class.new do; include AuthenticationSystem; end.new
- @user = User.create!(:email => 'user@example.com', :password => 'secret')
- end
- describe "the user property" do
- it "should initially be nil" do
- @auth.user.should be_nil
- end
- it "should be the authenticated user after authentication" do
- @auth.authenticate('user@example.com', 'secret')
- @auth.user.id.should == @user.id
- end
- it "should be nil after a failed authentication" do
- @auth.authenticate('user@example.com', 'guess')
- @auth.user.should be_nil
- end
- end
- end
Add Comment
Please, Sign In to add comment