From 17ff182c964e87fc58a4efb9b2cd067b1822fa77 Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Mon, 13 Mar 2017 10:20:06 +0000 Subject: [PATCH] Build pending users via factory --- test/controllers/user_controller_test.rb | 25 ++++++------------------ 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/test/controllers/user_controller_test.rb b/test/controllers/user_controller_test.rb index 87fb99a6f..8e1b079d4 100644 --- a/test/controllers/user_controller_test.rb +++ b/test/controllers/user_controller_test.rb @@ -231,7 +231,7 @@ class UserControllerTest < ActionController::TestCase end def test_new_success - user = new_user + user = build(:user, :pending) assert_difference "User.count", 1 do assert_difference "ActionMailer::Base.deliveries.size", 1 do @@ -252,7 +252,7 @@ class UserControllerTest < ActionController::TestCase end def test_new_duplicate_email - user = new_user + user = build(:user, :pending) user.email = users(:public_user).email assert_no_difference "User.count" do @@ -267,7 +267,7 @@ class UserControllerTest < ActionController::TestCase end def test_new_duplicate_email_uppercase - user = new_user + user = build(:user, :pending) user.email = users(:public_user).email.upcase assert_no_difference "User.count" do @@ -282,7 +282,7 @@ class UserControllerTest < ActionController::TestCase end def test_new_duplicate_name - user = new_user + user = build(:user, :pending) user.display_name = users(:public_user).display_name assert_no_difference "User.count" do @@ -297,7 +297,7 @@ class UserControllerTest < ActionController::TestCase end def test_new_duplicate_name_uppercase - user = new_user + user = build(:user, :pending) user.display_name = users(:public_user).display_name.upcase assert_no_difference "User.count" do @@ -312,7 +312,7 @@ class UserControllerTest < ActionController::TestCase end def test_save_referer_params - user = new_user + user = build(:user, :pending) assert_difference "User.count", 1 do assert_difference "ActionMailer::Base.deliveries.size", 1 do @@ -1487,17 +1487,4 @@ class UserControllerTest < ActionController::TestCase assert_equal "deleted", normal_user.reload.status assert_equal "deleted", confirmed_user.reload.status end - - private - - def new_user - user = User.new - user.status = "pending" - user.display_name = "new_tester" - user.email = "newtester@osm.org" - user.email_confirmation = "newtester@osm.org" - user.pass_crypt = "testtest" - user.pass_crypt_confirmation = "testtest" - user - end end -- 2.39.5