-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ユーザーの検索結果に、管理者でログインしたときだけそのユーザーの相談部屋へのリンクを表示 #4147
Changes from 20 commits
8790657
f859a3f
5b38b4a
b0f7b84
1142061
4059f8d
4c85f20
1bea353
8e9eea5
11ea071
9cdc350
f9d98ee
65cfe98
cc300ee
fe5ba3d
33b922b
fba40bd
6522a73
0072d92
634086f
8a7fa44
f6fc8a7
7f133ba
028fd7e
57c1b36
e2093ac
ad279f9
4b9677e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,13 @@ | ||||||
# frozen_string_literal: true | ||||||
|
||||||
require 'test_helper' | ||||||
|
||||||
class SearchHelperTest < ActionView::TestCase | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
test 'does it return correct boolean value in talk' do | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 「talkかどうかを返す」みたいな内容でいいと思います〜。 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. テスト名変更しました。 |
||||||
user = users(:kimura) | ||||||
assert_equal true, talk?(user) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. trueかどうかのチェックは There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. アサーションの種類について全然把握していませんでした🙇♂️ Rails テスティングガイドを見て assert と assert_not を用いるのが良いことを理解しました。 |
||||||
|
||||||
user = users(:taikai3) | ||||||
assert_equal false, talk?(user) | ||||||
end | ||||||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,4 +135,24 @@ class SearchablesTest < ApplicationSystemTestCase | |
assert_text 'kimura' | ||
assert_no_text 'machida' | ||
end | ||
|
||
test 'check that link to talk room is displayed properly' do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
こちらは二つのテストケースに分けた方がテストのタイトルと合わせてわかりやすいかもです〜 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 確かに…🙏 分割しました。 |
||
visit_with_auth '/', 'hatsuno' | ||
within('form[name=search]') do | ||
select 'すべて' | ||
fill_in 'word', with: '' | ||
end | ||
find('#test-search').click | ||
assert_no_text '相談部屋' | ||
|
||
logout | ||
|
||
visit_with_auth '/', 'komagata' | ||
within('form[name=search]') do | ||
select 'ユーザー' | ||
fill_in 'word', with: '' | ||
end | ||
find('#test-search').click | ||
assert_text '相談部屋' | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
対応するhelperのテストがあるといいかもです〜
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ヘルパーテストを追加するみたいな考えが全くありませんでした🙏
追加しました。