Created
September 28, 2011 19:33
-
-
Save brandonhilkert/1248988 to your computer and use it in GitHub Desktop.
This file contains 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_helper" | |
describe UsersController do | |
describe "authentication" do | |
let(:user) { FactoryGirl.create(:user) } | |
it "should properly log a user out" do | |
session[:user_id] == user.id | |
AnalyticLog.should_receive(:logout) <----- (<AnalyticLog (class)>).logout(any args) expected: 1 time received: 0 times | |
get :logout | |
session[:user_id].should == nil | |
response.should redirect_to(login_url) | |
end | |
end | |
end | |
class UsersController < ApplicationController | |
def logout | |
session[:user_id] = nil | |
AnalyticLog.logout(:user => user, :session => session) | |
redirect_to :controller => "sites", :action => "landing" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment