Skip to content

Commit

Permalink
テストを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
2525nicole committed Dec 17, 2023
1 parent 9d9e566 commit 3f9e802
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/models/user_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,16 @@ class UserTest < ActiveSupport::TestCase
assert target.sent_student_followup_message
end

test '#hibernation_elapsed_days' do
user = users(:kyuukai)

travel_to Time.zone.local(2020, 1, 10) do
elapsed_days = user.hibernation_elapsed_days

assert assert_equal 9, elapsed_days
end
end

test '#country_name' do
assert_equal '日本', users(:kimura).country_name
assert_equal '米国', users(:tom).country_name
Expand Down
14 changes: 14 additions & 0 deletions test/system/users_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -629,4 +629,18 @@ class UsersTest < ApplicationSystemTestCase
visit_with_auth user_path(user), 'komagata'
assert_no_text '休会中 / 休会から'
end

test 'show retirement message on users page' do
visit_with_auth users_path, 'komagata'
click_link('退会')
assert_selector '.users-item__inactive-message-container.is-only-mentor .users-item__inactive-message', text: '退会しました'
end

test 'show hibernation elasped days message on users page' do
travel_to Time.zone.local(2020, 1, 11, 0, 0, 0) do
visit_with_auth users_path, 'komagata'
click_link('休会')
assert_selector '.users-item__inactive-message-container.is-only-mentor .users-item__inactive-message', text: '休会中: 2020年01月01日〜(10日経過)'
end
end
end

0 comments on commit 3f9e802

Please sign in to comment.