Created
August 25, 2009 09:28
-
-
Save jamesbebbington/174593 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
# 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