Sha256: 4cab2563c52e1a1754c9a853c5ee43bc4edfb6293e2e6e49ebd7730aaaa06d51
Contents?: true
Size: 1.02 KB
Versions: 2
Compression:
Stored size: 1.02 KB
Contents
require 'test_helper' class Users::TokenAuthenticatableTest < ActionDispatch::IntegrationTest fixtures :all setup do @user = users(:julien) @user.reset_authentication_token! end test "should sign user in from token" do visit root_url(:auth_token => @user.authentication_token) assert_authenticated end test "should not sign user with invalid token" do visit root_url(:auth_token => 'unknown token') refute_authenticated end test "should reuse token" do Janus::Config.stub(:reusable_authentication_token, true) do token = @user.authentication_token visit root_url(:auth_token => token) sign_out :user visit root_url(:auth_token => token) assert_authenticated end end test "shouldn't reuse token" do Janus::Config.stub(:reusable_authentication_token, false) do token = @user.authentication_token visit root_url(:auth_token => token) sign_out :user visit root_url(:auth_token => token) refute_authenticated end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
janus-0.10.1 | test/integration/users/token_authenticatable_test.rb |
janus-0.10.0 | test/integration/users/token_authenticatable_test.rb |