summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAya Jaff <ayajaff@hotmail.com>2015-08-12 15:18:34 +0200
committerankonym <ankonym@gmail.com>2015-09-28 15:12:44 +0200
commit9156f1354f404c569e7fd337cff0171f6f43842e (patch)
treeb32b4026dfdbdf8a2b7b8e1161d2922891bf3d24
parent8f03c13a038469a1191666259ef5609c89d69d90 (diff)
Added an 'invite code' to all the tests for the sign-up form so we have a valid user for the tests again
-rw-r--r--Gemfile5
-rw-r--r--Gemfile.lock9
-rw-r--r--test/factories.rb2
-rw-r--r--test/integration/api/srp_test.rb4
-rw-r--r--test/support/browser_integration_test.rb1
-rw-r--r--test/unit/tmp_user_test.rb4
6 files changed, 21 insertions, 4 deletions
diff --git a/Gemfile b/Gemfile
index dd93a3c..fdd63f5 100644
--- a/Gemfile
+++ b/Gemfile
@@ -84,6 +84,11 @@ group :production do
gem 'SyslogLogger', '~> 2.0'
end
+group :development do
+ gem "better_errors", '1.1.0'
+ gem "binding_of_caller"
+end
+
group :debug do
gem 'debugger', :platforms => :mri_19
end
diff --git a/Gemfile.lock b/Gemfile.lock
index 42dea53..b859e81 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -56,6 +56,11 @@ GEM
multi_json (~> 1.0)
addressable (2.3.6)
arel (3.0.3)
+ better_errors (1.1.0)
+ coderay (>= 1.0.0)
+ erubis (>= 2.6.6)
+ binding_of_caller (0.7.2)
+ debug_inspector (>= 0.0.1)
bootstrap-sass (2.3.2.2)
sass (~> 3.2)
braintree (2.38.0)
@@ -72,6 +77,7 @@ GEM
client_side_validations (~> 3.2.5)
simple_form (~> 2.1.0)
cliver (0.3.2)
+ coderay (1.1.0)
columnize (0.9.0)
couchrest (1.1.3)
mime-types (~> 1.15)
@@ -99,6 +105,7 @@ GEM
nokogiri (~> 1.5)
rails (>= 3, < 5)
daemons (1.1.9)
+ debug_inspector (0.0.2)
debugger (1.6.8)
columnize (>= 0.3.1)
debugger-linecache (~> 1.2.0)
@@ -258,6 +265,8 @@ PLATFORMS
DEPENDENCIES
SyslogLogger (~> 2.0)
+ better_errors (= 1.1.0)
+ binding_of_caller
bootstrap-sass (= 2.3.2.2)
capybara
certificate_authority!
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