summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorazul <azul@riseup.net>2017-10-24 10:31:29 +0000
committerazul <azul@riseup.net>2017-10-24 10:31:29 +0000
commitfecd710de6c574ac8e2b0c45ad9e081badd59b61 (patch)
treefcb2604a0ed9e54a945749dd7a96bc081b537243 /test
parent522d632c2c1337c7af96befc4e6a9faab160e976 (diff)
parent85791203e764516b786d94f74f36a56e83ccbb2c (diff)
Merge branch 'bugfix/8807-cleanup-tmp-invites' into 'master'
Bugfix/8807 cleanup tmp invites Closes #8807 See merge request leap/webapp!49
Diffstat (limited to 'test')
-rw-r--r--test/unit/account_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/unit/account_test.rb b/test/unit/account_test.rb
index f81764d..61b40b5 100644
--- a/test/unit/account_test.rb
+++ b/test/unit/account_test.rb
@@ -153,6 +153,17 @@ class AccountTest < ActiveSupport::TestCase
end
end
+ test "Single use invite code is destroyed when used by tmp user" do
+ with_config invite_required: true do
+ attrs = user_attributes invite_code: @testcode.invite_code
+ attrs[:login] = 'tmp_user_' + attrs[:login]
+ user = Account.create(attrs)
+ user.save
+ assert user.persisted?, user.errors.inspect
+ assert_nil InviteCode.find_by_invite_code user.invite_code
+ end
+ end
+
test "Invite code stays zero when invite code is not used" do
#user = Account.create(user_attributes( :invite_code => @testcode.invite_code))
invalid_user = FactoryGirl.build(:user, :invite_code => @testcode.invite_code)