Skip to content

Commit

Permalink
users_roleのテストケースを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
Kassy0220 committed Dec 3, 2023
1 parent 40f6c1e commit b2b3470
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/models/user_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,12 @@ class UserTest < ActiveSupport::TestCase

test '.users_role' do
allowed_targets = %w[student_and_trainee mentor graduate adviser trainee year_end_party]

# target引数とdefault_target引数に関して、targetとscope名が一致しているケースと一致していないケースを順にテストする
assert_equal User.mentor, User.users_role('mentor', allowed_targets: allowed_targets, default_target: 'student_and_trainee')
assert_equal User.graduated, User.users_role('graduate', allowed_targets: allowed_targets, default_target: 'student_and_trainee')

assert_equal User.year_end_party, User.users_role('', allowed_targets: allowed_targets, default_target: 'year_end_party')
assert_equal User.students_and_trainees, User.users_role('', allowed_targets: allowed_targets, default_target: 'student_and_trainee')
end

Expand Down

0 comments on commit b2b3470

Please sign in to comment.