-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5454 from fjordllc/feature/notification-of-hibern…
…ation ユーザーが休会した時にメンターと管理者にサイト内通知とメール通知が行くようにした
- Loading branch information
Showing
6 changed files
with
152 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'application_system_test_case' | ||
|
||
class Notification::HibernationTest < ApplicationSystemTestCase | ||
setup do | ||
@delivery_mode = AbstractNotifier.delivery_mode | ||
AbstractNotifier.delivery_mode = :normal | ||
end | ||
|
||
teardown do | ||
AbstractNotifier.delivery_mode = @delivery_mode | ||
end | ||
|
||
test 'notify admins and mentors when a student hibernate' do | ||
visit_with_auth notifications_path, 'komagata' | ||
find('#notifications.loaded', wait: 10) | ||
within first('.card-list-item') do | ||
assert_no_selector '.card-list-item-title__link-label', text: 'kimuraさんが休会しました。' | ||
end | ||
|
||
visit_with_auth new_hibernation_path, 'kimura' | ||
fill_in 'hibernation[scheduled_return_on]', with: Time.current.next_month | ||
fill_in 'hibernation[reason]', with: 'テストのため' | ||
accept_confirm do | ||
click_button '休会する' | ||
end | ||
assert_text '休会処理が完了しました' | ||
|
||
visit_with_auth notifications_path, 'komagata' | ||
find('#notifications.loaded', wait: 10) | ||
within first('.card-list-item.is-unread') do | ||
assert_selector '.card-list-item-title__link-label', text: 'kimuraさんが休会しました。' | ||
end | ||
end | ||
|
||
test 'notify admins and mentors when a trainee hibernate' do | ||
visit_with_auth notifications_path, 'komagata' | ||
find('#notifications.loaded', wait: 10) | ||
within first('.card-list-item') do | ||
assert_no_selector '.card-list-item-title__link-label', text: 'kensyuさんが休会しました。' | ||
end | ||
|
||
visit_with_auth new_hibernation_path, 'kensyu' | ||
fill_in 'hibernation[scheduled_return_on]', with: Time.current.next_month | ||
fill_in 'hibernation[reason]', with: 'テストのため' | ||
accept_confirm do | ||
click_button '休会する' | ||
end | ||
assert_text '休会処理が完了しました' | ||
|
||
visit_with_auth notifications_path, 'komagata' | ||
find('#notifications.loaded', wait: 10) | ||
within first('.card-list-item.is-unread') do | ||
assert_selector '.card-list-item-title__link-label', text: 'kensyuさんが休会しました。' | ||
end | ||
end | ||
|
||
test 'notify admins and mentors when a adviser hibernate' do | ||
visit_with_auth notifications_path, 'komagata' | ||
find('#notifications.loaded', wait: 10) | ||
within first('.card-list-item') do | ||
assert_no_selector '.card-list-item-title__link-label', text: 'senpaiさんが休会しました。' | ||
end | ||
|
||
visit_with_auth new_hibernation_path, 'senpai' | ||
fill_in 'hibernation[scheduled_return_on]', with: Time.current.next_month | ||
fill_in 'hibernation[reason]', with: 'テストのため' | ||
accept_confirm do | ||
click_button '休会する' | ||
end | ||
assert_text '休会処理が完了しました' | ||
|
||
visit_with_auth notifications_path, 'komagata' | ||
find('#notifications.loaded', wait: 10) | ||
within first('.card-list-item.is-unread') do | ||
assert_selector '.card-list-item-title__link-label', text: 'senpaiさんが休会しました。' | ||
end | ||
end | ||
end |