Skip to content

Instantly share code, notes, and snippets.

@jamesbebbington
Created August 25, 2009 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesbebbington/174593 to your computer and use it in GitHub Desktop.
Save jamesbebbington/174593 to your computer and use it in GitHub Desktop.
# Works:
require 'test_helper'
class RootControllerTest < ActionController::TestCase
setup :activate_authlogic
context "A User" do
setup do
@user = Factory(:user)
end
context "that is logged in" do
setup do
UserSession.create(@user)
end
context 'on GET to :index' do
setup { get :index }
should_respond_with :success
should_not_set_the_flash
should "not have a log in link" do
assert_select "a.login", 0
end
should "have a log out link" do
assert_select "a.logout"
end
end
end
end
end
# Doesn't work :(
require 'test_helper'
class AuthenticationTest < ActionController::IntegrationTest
setup :activate_authlogic
context "A User" do
setup do
@user = Factory(:user)
end
should "be able to log out" do
UserSession.create(@user)
visit '/'
click_link_within "#utilities", "Log out"
assert !logged_in?
assert_equal '/', path
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment