Skip to content

Commit

Permalink
test: OmniAuth.config.mock_authの設定方法を変更 (#66)
Browse files Browse the repository at this point in the history
以前の設定方法で複数ファイルのテストを同時に実行すると、invalidのmockが後続のテストファイルに引き継がれてテストが落ちていた
  • Loading branch information
djkazunoko committed Apr 10, 2024
1 parent 4118dc5 commit 952a3dc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions spec/requests/user_sessions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
describe 'DELETE /destroy' do
it 'removes user id from session' do
get '/auth/github/callback'
expect(session[:user_id]).to be_present
delete '/logout'
expect(session[:user_id]).to be_nil
end
Expand Down
2 changes: 1 addition & 1 deletion spec/system/users_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

context 'when authentication is failed' do
before do
OmniAuth.config.mock_auth[:github] = :invalid_credentials
Rails.application.env_config['omniauth.auth'] = github_invalid_mock
end

it 'redirects to root_path' do
Expand Down

0 comments on commit 952a3dc

Please sign in to comment.