diff options
author | Azul <azul@riseup.net> | 2017-10-24 12:12:26 +0200 |
---|---|---|
committer | Azul <azul@riseup.net> | 2017-10-24 12:12:26 +0200 |
commit | 3a1a6fde9a1fc2ea2a8f081a9d2578ec718bdd32 (patch) | |
tree | 319fce57d780e4cdfb519a5f607466724814c1dc /test | |
parent | 522d632c2c1337c7af96befc4e6a9faab160e976 (diff) |
fix: also remove invite codes used for tmp users
fixes #8807
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/account_test.rb | 11 |
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) |