summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorankonym <ankonym@gmail.com>2015-10-07 12:11:21 +0200
committerankonym <ankonym@gmail.com>2015-10-07 12:11:21 +0200
commitdc426cc777aec921772c1d8c2fa014d61aa90d33 (patch)
treed275ab8beebbad71df4806e132c64d86e9d4e90d /tests
parentb53bd889d5407fb357329b414bcae929176c0690 (diff)
Modify bonafide_helper to improve user creation test with invites
Will now use the correct user to generate invite codes and only add invite code parameter when invite codes are enabled
Diffstat (limited to 'tests')
-rw-r--r--tests/helpers/bonafide_helper.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/helpers/bonafide_helper.rb b/tests/helpers/bonafide_helper.rb
index 39f761fe..1a6dc6fe 100644
--- a/tests/helpers/bonafide_helper.rb
+++ b/tests/helpers/bonafide_helper.rb
@@ -34,7 +34,10 @@ class LeapTest
url = api_url("/1/users.json")
params = user.to_params
- params['user[invite_code]'] = generate_invite_code
+
+ if property('webapp.invite_required')
+ params['user[invite_code]'] = generate_invite_code
+ end
assert_post(url, params) do |body|
assert response = JSON.parse(body), 'response should be JSON'
@@ -45,9 +48,7 @@ class LeapTest
end
def generate_invite_code
- if property('webapp.invite_required')
- `cd /srv/leap/webapp/ && sudo RAILS_ENV=production bundle exec rake generate_invites[1]`.gsub(/\n/, "")
- end
+ `cd /srv/leap/webapp/ && sudo -u leap-webapp RAILS_ENV=production bundle exec rake generate_invites[1]`.gsub(/\n/, "")
end