]> source.dussan.org Git - redmine.git/commitdiff
code layout clean up test/functional/users_controller_test.rb
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Mon, 25 Nov 2019 16:47:09 +0000 (16:47 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Mon, 25 Nov 2019 16:47:09 +0000 (16:47 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@19295 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/functional/users_controller_test.rb

index 2a6a5d138dc7743c0d20631d1674073658475a2b..437e59666f39bde2e563f97df55737dcbbd6c6fc 100644 (file)
@@ -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