summaryrefslogtreecommitdiffstats
path: root/test/functional/users_controller_test.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2019-11-25 16:47:09 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2019-11-25 16:47:09 +0000
commitb6296adf16c9d3f3952c59fb75eba20a17206467 (patch)
treee6803a84e51dfcc55ca0ec9ad406d8e093e736e0 /test/functional/users_controller_test.rb
parent7956c48e300bb62d4d54f75ef4502166ccf16818 (diff)
downloadredmine-b6296adf16c9d3f3952c59fb75eba20a17206467.tar.gz
redmine-b6296adf16c9d3f3952c59fb75eba20a17206467.zip
code layout clean up test/functional/users_controller_test.rb
git-svn-id: http://svn.redmine.org/redmine/trunk@19295 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/users_controller_test.rb')
-rw-r--r--test/functional/users_controller_test.rb95
1 files changed, 78 insertions, 17 deletions
diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb
index 2a6a5d138..437e59666 100644
--- a/test/functional/users_controller_test.rb
+++ b/test/functional/users_controller_test.rb
@@ -393,14 +393,25 @@ class UsersControllerTest < Redmine::ControllerTest
assert_not_nil (mail = ActionMailer::Base.deliveries.last)
assert_mail_body_match '0.0.0.0', mail
- assert_mail_body_match I18n.t(:mail_body_security_notification_add, field: I18n.t(:field_admin), value: 'eschmoe'), mail
+ assert_mail_body_match(
+ I18n.t(
+ :mail_body_security_notification_add,
+ field: I18n.t(:field_admin),
+ value: 'eschmoe'
+ ),
+ mail
+ )
assert_select_email do
assert_select 'a[href^=?]', 'http://localhost:3000/users', :text => 'Users'
end
# All admins should receive this
User.where(admin: true, status: Principal::STATUS_ACTIVE).each do |admin|
- assert_not_nil ActionMailer::Base.deliveries.detect{|mail| [mail.bcc, mail.cc].flatten.include?(admin.mail) }
+ assert_not_nil(
+ ActionMailer::Base.deliveries.detect do |mail|
+ [mail.bcc, mail.cc].flatten.include?(admin.mail)
+ end
+ )
end
end
@@ -611,11 +622,21 @@ class UsersControllerTest < Redmine::ControllerTest
}
assert_not_nil (mail = ActionMailer::Base.deliveries.last)
- assert_mail_body_match I18n.t(:mail_body_security_notification_add, field: I18n.t(:field_admin), value: User.find(2).login), mail
-
+ assert_mail_body_match(
+ I18n.t(
+ :mail_body_security_notification_add,
+ field: I18n.t(:field_admin),
+ value: User.find(2).login
+ ),
+ mail
+ )
# All admins should receive this
User.where(admin: true, status: Principal::STATUS_ACTIVE).each do |admin|
- assert_not_nil ActionMailer::Base.deliveries.detect{|mail| [mail.bcc, mail.cc].flatten.include?(admin.mail) }
+ assert_not_nil(
+ ActionMailer::Base.deliveries.detect do |mail|
+ [mail.bcc, mail.cc].flatten.include?(admin.mail)
+ end
+ )
end
end
@@ -631,11 +652,21 @@ class UsersControllerTest < Redmine::ControllerTest
}
assert_not_nil (mail = ActionMailer::Base.deliveries.last)
- assert_mail_body_match I18n.t(:mail_body_security_notification_remove, field: I18n.t(:field_admin), value: user.login), mail
-
+ assert_mail_body_match(
+ I18n.t(
+ :mail_body_security_notification_remove,
+ field: I18n.t(:field_admin),
+ value: user.login
+ ),
+ mail
+ )
# All admins should receive this
User.where(admin: true, status: Principal::STATUS_ACTIVE).each do |admin|
- assert_not_nil ActionMailer::Base.deliveries.detect{|mail| [mail.bcc, mail.cc].flatten.include?(admin.mail) }
+ assert_not_nil(
+ ActionMailer::Base.deliveries.detect do |mail|
+ [mail.bcc, mail.cc].flatten.include?(admin.mail)
+ end
+ )
end
end
@@ -651,11 +682,21 @@ class UsersControllerTest < Redmine::ControllerTest
}
assert_not_nil (mail = ActionMailer::Base.deliveries.last)
- assert_mail_body_match I18n.t(:mail_body_security_notification_remove, field: I18n.t(:field_admin), value: User.find(2).login), mail
-
+ assert_mail_body_match(
+ I18n.t(
+ :mail_body_security_notification_remove,
+ field: I18n.t(:field_admin),
+ value: User.find(2).login
+ ),
+ mail
+ )
# All admins should receive this
User.where(admin: true, status: Principal::STATUS_ACTIVE).each do |admin|
- assert_not_nil ActionMailer::Base.deliveries.detect{|mail| [mail.bcc, mail.cc].flatten.include?(admin.mail) }
+ assert_not_nil(
+ ActionMailer::Base.deliveries.detect do |mail|
+ [mail.bcc, mail.cc].flatten.include?(admin.mail)
+ end
+ )
end
# if user is already locked, destroying should not send a second mail
@@ -677,11 +718,21 @@ class UsersControllerTest < Redmine::ControllerTest
}
assert_not_nil (mail = ActionMailer::Base.deliveries.last)
- assert_mail_body_match I18n.t(:mail_body_security_notification_add, field: I18n.t(:field_admin), value: user.login), mail
-
+ assert_mail_body_match(
+ I18n.t(
+ :mail_body_security_notification_add,
+ field: I18n.t(:field_admin),
+ value: user.login
+ ),
+ mail
+ )
# All admins should receive this
User.where(admin: true, status: Principal::STATUS_ACTIVE).each do |admin|
- assert_not_nil ActionMailer::Base.deliveries.detect{|mail| [mail.bcc, mail.cc].flatten.include?(admin.mail) }
+ assert_not_nil(
+ ActionMailer::Base.deliveries.detect do |mail|
+ [mail.bcc, mail.cc].flatten.include?(admin.mail)
+ end
+ )
end
end
@@ -740,11 +791,21 @@ class UsersControllerTest < Redmine::ControllerTest
delete :destroy, :params => {:id => user.id}
assert_not_nil (mail = ActionMailer::Base.deliveries.last)
- assert_mail_body_match I18n.t(:mail_body_security_notification_remove, field: I18n.t(:field_admin), value: user.login), mail
-
+ assert_mail_body_match(
+ I18n.t(
+ :mail_body_security_notification_remove,
+ field: I18n.t(:field_admin),
+ value: user.login
+ ),
+ mail
+ )
# All admins should receive this
User.where(admin: true, status: Principal::STATUS_ACTIVE).each do |admin|
- assert_not_nil ActionMailer::Base.deliveries.detect{|mail| [mail.bcc, mail.cc].flatten.include?(admin.mail) }
+ assert_not_nil(
+ ActionMailer::Base.deliveries.detect do |mail|
+ [mail.bcc, mail.cc].flatten.include?(admin.mail)
+ end
+ )
end
end
end