Merged
Conversation
c36172c to
2a96b91
Compare
+ 失敗していたテストのスキップを外した.
+ test/test_helper.rb のmock作成時に uid を user.id
にしていた箇所を user.uid に変更することで,ほとんどの
テストが成功するようになった.
+ 上記変更後も,should_destroy_user は失敗する.
+ 以前の議論により,ユーザは基本的に削除しない方針になった.
+ model 側でユーザ削除をスキップするバリデーションがかかる
ようになったため,テストが失敗する.
+ エラーへの対処として,削除が成功するテストを削除し,
代わりに削除できるべきではない should_not_destroy_user
テストを追加した.
2a96b91 to
857280c
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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を追加した.