Ensure that the blocked template rendering works
authorAndy Allan <git@gravitystorm.co.uk>
Wed, 14 Nov 2018 11:18:53 +0000 (12:18 +0100)
committerAndy Allan <git@gravitystorm.co.uk>
Wed, 14 Nov 2018 11:19:23 +0000 (12:19 +0100)
test/controllers/users_controller_test.rb

index 57dddc25828a037d8298b554b01fb9043003172f..7eda2a53ac1e7e65598aac29b342db9c013b9d97 100644 (file)
@@ -323,6 +323,22 @@ class UsersControllerTest < ActionController::TestCase
     assert_select "form > fieldset > div.form-row > input.field_with_errors#user_display_name"
   end
 
+  def test_new_blocked_domain
+    user = build(:user, :pending, :email => "user@example.net")
+    create(:acl, :domain => "example.net", :k => "no_account_creation")
+
+    assert_no_difference "User.count" do
+      assert_no_difference "ActionMailer::Base.deliveries.size" do
+        perform_enqueued_jobs do
+          post :save, :session => { :new_user => user }
+        end
+      end
+    end
+
+    assert_response :success
+    assert_template "blocked"
+  end
+
   def test_save_referer_params
     user = build(:user, :pending)