-
-
Notifications
You must be signed in to change notification settings - Fork 24
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 #5126 from dodona-edu/fix/no-reply
Do not send emails to github noreply
- Loading branch information
Showing
2 changed files
with
44 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -374,10 +374,47 @@ def teardown | |
@remote.copy_dir(@echo.path, new_dir) | ||
@remote.commit('copy exercise') | ||
|
||
@repository.reset | ||
assert_difference 'ActionMailer::Base.deliveries.size', +1 do | ||
@repository.process_activities_email_errors(email: '[email protected]') | ||
end | ||
|
||
assert_equal '[email protected]', ActionMailer::Base.deliveries.last.to[0] | ||
end | ||
|
||
test 'should not send a mail to github noreply' do | ||
# make sure commit fails | ||
@repository.stubs(:commit).returns([false, ['commit fail']]) | ||
|
||
# add an activity to make sure that commit will be executed inside @repository.process_activities | ||
new_dir = 'echo2' | ||
@remote.copy_dir(@echo.path, new_dir) | ||
@remote.commit('copy exercise') | ||
|
||
@repository.reset | ||
assert_difference 'ActionMailer::Base.deliveries.size', +1 do | ||
@repository.process_activities_email_errors(email: '[email protected]') | ||
end | ||
|
||
assert_equal '[email protected]', ActionMailer::Base.deliveries.last.to[0] | ||
end | ||
|
||
test 'should email first admin if present' do | ||
# make sure commit fails | ||
@repository.stubs(:commit).returns([false, ['commit fail']]) | ||
@repository.admins << create(:staff, email: '[email protected]') | ||
|
||
# add an activity to make sure that commit will be executed inside @repository.process_activities | ||
new_dir = 'echo2' | ||
@remote.copy_dir(@echo.path, new_dir) | ||
@remote.commit('copy exercise') | ||
|
||
@repository.reset | ||
assert_difference 'ActionMailer::Base.deliveries.size', +1 do | ||
@repository.process_activities_email_errors | ||
end | ||
|
||
assert_equal '[email protected]', ActionMailer::Base.deliveries.last.to[0] | ||
end | ||
|
||
test 'has allowed course should filter correctly' do | ||
|