summaryrefslogtreecommitdiff
path: root/test/unit
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2016-04-11 14:10:38 -0700
committerelijah <elijah@riseup.net>2016-04-11 14:10:38 -0700
commit7e0cd47ab44389fb9933345407ad2c2cd2a579b6 (patch)
tree1a386bafde43b7e85494790c3a916c434ae5d0d3 /test/unit
parent32617f3f90a172228d1a35ea418d716c813824c4 (diff)
allow monitor auth to create users even if invites are normally required.
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/account_test.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/unit/account_test.rb b/test/unit/account_test.rb
index 9680b33..d56541a 100644
--- a/test/unit/account_test.rb
+++ b/test/unit/account_test.rb
@@ -21,6 +21,23 @@ class AccountTest < ActiveSupport::TestCase
user.account.destroy
end
+ test "fail to create account without invite" do
+ with_config invite_required: true do
+ user = Account.create(FactoryGirl.attributes_for(:user))
+ assert !user.valid?, "user should not be valid"
+ assert !user.persisted?, "user should not have been saved"
+ end
+ end
+
+ test "allow invite_required override" do
+ with_config invite_required: true do
+ user = Account.create(FactoryGirl.attributes_for(:user), :invite_required => false)
+ assert user.valid?, "unexpected errors: #{user.errors.inspect}"
+ assert user.persisted?, "user should have been saved"
+ user.account.destroy
+ end
+ end
+
test "create a new account" do
with_config invite_required: false do
user = Account.create(FactoryGirl.attributes_for(:user))