Commit 7af9fa59a99bdc295bdc95029decdcb12e44104f
1 parent
ae3e67e3
Exists in
master
and in
28 other branches
Revert "Revert "Do not send email to template users""
This reverts commit b8920a1e95ef9e9d54527de691fbeb1b1921a27f. Conflicts: app/models/user.rb
Showing
2 changed files
with
8 additions
and
1 deletions
Show diff stats
app/models/user.rb
| ... | ... | @@ -328,7 +328,7 @@ class User < ActiveRecord::Base |
| 328 | 328 | end |
| 329 | 329 | |
| 330 | 330 | def deliver_activation_code |
| 331 | - return if person.identifier =~ /person_template/ | |
| 331 | + return if person.is_template? | |
| 332 | 332 | User::Mailer.deliver_activation_code(self) unless self.activation_code.blank? |
| 333 | 333 | end |
| 334 | 334 | ... | ... |
test/unit/user_test.rb
| ... | ... | @@ -447,6 +447,13 @@ class UserTest < ActiveSupport::TestCase |
| 447 | 447 | assert_equal 'pending@activation.com', ActionMailer::Base.deliveries.last['to'].to_s |
| 448 | 448 | end |
| 449 | 449 | |
| 450 | + should 'not try to deliver email to template users' do | |
| 451 | + Person.any_instance.stubs(:is_template?).returns(true) | |
| 452 | + assert_no_difference ActionMailer::Base.deliveries, :size do | |
| 453 | + new_user | |
| 454 | + end | |
| 455 | + end | |
| 456 | + | |
| 450 | 457 | should 'not mass assign activated at' do |
| 451 | 458 | user = User.new :activated_at => 5.days.ago |
| 452 | 459 | assert_nil user.activated_at | ... | ... |