summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorazul <azul@leap.se>2014-07-11 13:00:27 +0200
committerazul <azul@leap.se>2014-07-11 13:00:27 +0200
commit1c7308207a9ab46cfb60c72aceaee2b3c82281fe (patch)
tree858f22fd9167b490b8b3fcaed2884215d0f0018a /test
parentc9dd5a342f902b27aec73af24776025a03feda48 (diff)
parent140155f32a9bd8ef2d5a581a1e56701a44a8f5a7 (diff)
Merge pull request #178 from fbernitt/issue_5217_allow_registration
Added allow_registration toggle.
Diffstat (limited to 'test')
-rw-r--r--test/functional/users_controller_test.rb7
-rw-r--r--test/functional/v1/users_controller_test.rb8
2 files changed, 15 insertions, 0 deletions
diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb
index 0713836..4af9ca6 100644
--- a/test/functional/users_controller_test.rb
+++ b/test/functional/users_controller_test.rb
@@ -162,4 +162,11 @@ class UsersControllerTest < ActionController::TestCase
assert !assigns(:user).enabled?
end
+ test "new redirects if registration is closed" do
+ with_config(allow_registration: false) do
+ get :new
+ assert_response :redirect
+ assert_redirected_to home_path
+ end
+ end
end
diff --git a/test/functional/v1/users_controller_test.rb b/test/functional/v1/users_controller_test.rb
index 7cd9b0c..fe3cfe7 100644
--- a/test/functional/v1/users_controller_test.rb
+++ b/test/functional/v1/users_controller_test.rb
@@ -71,4 +71,12 @@ class V1::UsersControllerTest < ActionController::TestCase
assert assigns(:users)
end
+ test "create returns forbidden if registration is closed" do
+ user_attribs = record_attributes_for :user
+ with_config(allow_registration: false) do
+ post :create, :user => user_attribs, :format => :json
+ assert_response :forbidden
+ end
+ end
+
end