ftp-manager/test/controllers/auth_controller_test.rb

39 lines
1.1 KiB
Ruby
Raw Permalink Normal View History

2016-09-18 09:41:51 -05:00
# frozen_string_literal: true
2016-09-12 22:15:44 -05:00
require 'test_helper'
class AuthControllerTest < ActionDispatch::IntegrationTest
include TestAuthHelper
2016-09-18 11:16:35 -05:00
test "Should fake login process" do
# This is not a real test of AuthController!
2016-09-28 21:23:01 -05:00
# We are really testing that the monkey patch is correct
#
# This simply tests to make sure the test suite is
# properly monkey patching the oAuth network call and
# faking the needed session variables.
#
# If you want to really test the oAuth flow you will need to
# hit the real services, or stand up a proper fake service.
get auth_path
assert_redirected_to accounts_path
end
test "should verify callbacks result" do
# If AuthController#callback ever changes final
# redirection, the patched version should also
# be updated in (lin e10) of
# test/test_helpers/test_auth_helper.rb
assert_equal "redirect_to accounts_path", last_line_in_callback
end
2016-09-18 11:16:35 -05:00
test 'should logout' do
get auth_path
assert session[:token]
get logout_path
assert session[:token].nil?
assert_redirected_to login_path
end
2016-09-12 22:15:44 -05:00
end