summaryrefslogtreecommitdiff
path: root/test/support
diff options
context:
space:
mode:
authorankonym <ankonym@gmail.com>2015-09-21 18:34:04 +0200
committerankonym <ankonym@gmail.com>2015-09-28 15:12:46 +0200
commit9adbde13619de8b2c300056b062d12f0961cb710 (patch)
treef9161d0a39b497cca05887a0e4fc48acde5aa650 /test/support
parentca591b482870c93674aaf454e90f56796da7d87d (diff)
Make invite code configurable
Through the config param 'invite_required', providers can decide whether users need to provide an invite code upon signup. The default setting is false.
Diffstat (limited to 'test/support')
-rw-r--r--test/support/browser_integration_test.rb35
1 files changed, 26 insertions, 9 deletions
diff --git a/test/support/browser_integration_test.rb b/test/support/browser_integration_test.rb
index 34ec9a6..35887cc 100644
--- a/test/support/browser_integration_test.rb
+++ b/test/support/browser_integration_test.rb
@@ -47,15 +47,32 @@ class BrowserIntegrationTest < ActionDispatch::IntegrationTest
end
def submit_signup(username = nil, password = nil)
- username ||= "test_#{SecureRandom.urlsafe_base64}".downcase
- password ||= SecureRandom.base64
- visit '/users/new'
- fill_in 'Username', with: username
- fill_in 'Password', with: password
- fill_in 'Invite code', with: @testcode.invite_code
- fill_in 'Password confirmation', with: password
- click_on 'Sign Up'
- return username, password
+
+ with_config invite_required: true do
+
+ username ||= "test_#{SecureRandom.urlsafe_base64}".downcase
+ password ||= SecureRandom.base64
+ visit '/users/new'
+ fill_in 'Username', with: username
+ fill_in 'Password', with: password
+ fill_in 'Invite code', with: @testcode.invite_code
+ fill_in 'Password confirmation', with: password
+ click_on 'Sign Up'
+ return username, password
+ end
+
+ with_config invite_required: false do
+
+ username ||= "test_#{SecureRandom.urlsafe_base64}".downcase
+ password ||= SecureRandom.base64
+ visit '/users/new'
+ fill_in 'Username', with: username
+ fill_in 'Password', with: password
+ fill_in 'Password confirmation', with: password
+ click_on 'Sign Up'
+ return username, password
+ end
+
end
# currently this only works for tests with poltergeist.