diff --git a/config/routes.rb b/config/routes.rb index 9b1bddd37..4ca24c71e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -255,10 +255,8 @@ Rails.application.routes.draw do get :labels end end - resource :session do - collection do - get :sign_out - end + resource :session, only: [:new, :create, :destroy] do + get :sign_out, on: :collection end resource :source, :only => [:show] resources :tags do diff --git a/test/functional/sessions_controller_test.rb b/test/functional/sessions_controller_test.rb index 0dd3bdbfc..a3c75a0b8 100644 --- a/test/functional/sessions_controller_test.rb +++ b/test/functional/sessions_controller_test.rb @@ -30,5 +30,13 @@ class SessionsControllerTest < ActionDispatch::IntegrationTest assert_nil(session[:user_id]) end end + + context "sign_out action" do + should "clear the session" do + get_auth sign_out_session_path, @user + assert_redirected_to posts_path + assert_nil(session[:user_id]) + end + end end end