-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b44f7ae
commit 5f7fccf
Showing
1 changed file
with
23 additions
and
6 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,31 @@ | ||
require 'test_helper' | ||
|
||
class SessionsControllerTest < ActionDispatch::IntegrationTest | ||
test "should get login" do | ||
get sessions_login_url | ||
assert_response :success | ||
|
||
test 'should not get login' do | ||
# ログイン用のURLは "/login" に設定されており, "/sessions/login" は使用できない | ||
assert_raises(ActionController::RoutingError) do | ||
get '/sessions/login' | ||
end | ||
end | ||
|
||
test 'should not get logout' do | ||
# ログアウト用のURLは "/logout" に設定されており, "/sessions/logout" は使用できない | ||
assert_raises(ActionController::RoutingError) do | ||
get '/sessions/logout' | ||
end | ||
end | ||
|
||
test 'should be redirected to google authentication page' do | ||
# ログイン用のURLにアクセスするとGoogleの認証ページにリダイレクトされる | ||
get '/login' | ||
assert_response :redirect | ||
end | ||
|
||
test "should get logout" do | ||
get sessions_logout_url | ||
assert_response :success | ||
test 'should get logout' do | ||
# ログアウト用のURLに(未ログイン状態で)アクセスするとトップページにリダイレクトされる | ||
get '/logout' | ||
assert_response :redirect | ||
end | ||
|
||
end |