Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Controllers test の失敗していたテストを修正した.
具体的には,
test/test_helper.rb
内の OmniAuth mock 作成時に,uid
にuser.id
ではなくuser.uid
を指定することでほとんどのテストが成功した.(それでもなお失敗したテストについては後述する)失敗までの流れを以下に示す.
SessionsController
のcreate
時に以下のコードが走る.user = User.find_by_provider_and_uid(auth["provider"], auth["uid"]) || User.create_with_omniauth(auth)
User.find_by_provider_and_uid
で,uid が 1 のエントリを検索するが,存在しないため,新たなユーザを作成する.session[:user_id]
に保存する.current_user?
で,ログインしたいユーザと新規ユーザの id を比較し,false が返ってくる.上記変更でも失敗していた
should destroy user
についてshould_destroy_user
を含めたユーザ削除の成功を期待するテストを削除した.should_not_destroy_user
を追加した.