From 9156f1354f404c569e7fd337cff0171f6f43842e Mon Sep 17 00:00:00 2001 From: Aya Jaff Date: Wed, 12 Aug 2015 15:18:34 +0200 Subject: Added an 'invite code' to all the tests for the sign-up form so we have a valid user for the tests again --- test/factories.rb | 2 ++ test/integration/api/srp_test.rb | 4 ++-- test/support/browser_integration_test.rb | 1 + test/unit/tmp_user_test.rb | 4 ++-- 4 files changed, 7 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/factories.rb b/test/factories.rb index 0734688..1a778ff 100644 --- a/test/factories.rb +++ b/test/factories.rb @@ -11,6 +11,8 @@ FactoryGirl.define do login { Faker::Internet.user_name + '_' + SecureRandom.hex(4) } password_verifier "1234ABCD" password_salt "4321AB" + invite_code "testcode" + factory :user_with_settings do email_forward { Faker::Internet.email } diff --git a/test/integration/api/srp_test.rb b/test/integration/api/srp_test.rb index fbef47e..ea06cde 100644 --- a/test/integration/api/srp_test.rb +++ b/test/integration/api/srp_test.rb @@ -32,10 +32,10 @@ class SrpTest < RackTest attr_reader :server_auth - def register_user(login = "integration_test", password = 'srp, verify me!') + def register_user(login = "integration_test", password = 'srp, verify me!', invite_code = "testcode") cleanup_user(login) post 'http://api.lvh.me:3000/1/users.json', - user_params(login: login, password: password) + user_params(login: login, password: password, invite_code: invite_code) assert(@user = User.find_by_login(login), 'user should have been created: %s' % last_response_errors) @login = login @password = password diff --git a/test/support/browser_integration_test.rb b/test/support/browser_integration_test.rb index 1e2aa51..48c7623 100644 --- a/test/support/browser_integration_test.rb +++ b/test/support/browser_integration_test.rb @@ -50,6 +50,7 @@ class BrowserIntegrationTest < ActionDispatch::IntegrationTest visit '/users/new' fill_in 'Username', with: username fill_in 'Password', with: password + fill_in 'Invite code', with: 'testcode' fill_in 'Password confirmation', with: password click_on 'Sign Up' return username, password diff --git a/test/unit/tmp_user_test.rb b/test/unit/tmp_user_test.rb index 55b117f..af2218e 100644 --- a/test/unit/tmp_user_test.rb +++ b/test/unit/tmp_user_test.rb @@ -8,13 +8,13 @@ class TmpUserTest < ActiveSupport::TestCase assert_difference('User.database.info["doc_count"]') do normal_user = User.create!(:login => 'a'+SecureRandom.hex(5).downcase, - :password_verifier => 'ABCDEF0010101', :password_salt => 'ABCDEF') + :password_verifier => 'ABCDEF0010101', :password_salt => 'ABCDEF', :invite_code => 'testcode') refute normal_user.database.to_s.include?('tmp') end assert_difference('User.tmp_database.info["doc_count"]') do tmp_user = User.create!(:login => 'test_user_'+SecureRandom.hex(5).downcase, - :password_verifier => 'ABCDEF0010101', :password_salt => 'ABCDEF') + :password_verifier => 'ABCDEF0010101', :password_salt => 'ABCDEF', :invite_code => 'testcode') assert tmp_user.database.to_s.include?('tmp') end ensure -- cgit v1.2.3