Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# 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