Skip to content

Commit

Permalink
モデルテスト追加
Browse files Browse the repository at this point in the history
  • Loading branch information
reckyy committed Feb 17, 2024
1 parent 987cc37 commit de9619b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/models/searcher_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,23 @@ def assert_includes_classes(results, *expected_classes)
assert_includes(result, practices(:practice55))
assert_not_includes(result, practices(:practice56))
end

test 'returns search results by job' do
result = Searcher.search('学生', @test_user)
User.where(job: 'student').find_each do |user|
assert_includes result, user
end
end

test 'returns search results by job when user is mentor' do
result = Searcher.search('学生', users(:mentormentaro))
User.where(job: 'student').find_each do |user|
assert_includes result, user
end
end

test 'does not return search results by job when user is other than admin or mentor' do
result = Searcher.search('学生', users(:advijirou))
assert_empty result
end
end

0 comments on commit de9619b

Please sign in to comment.