diff options
author | azul <azul@riseup.net> | 2016-08-15 09:26:39 +0000 |
---|---|---|
committer | azul <azul@riseup.net> | 2016-08-15 09:26:39 +0000 |
commit | 1457fcdae08a1cd7e1e7b36668f826547d2c7cf6 (patch) | |
tree | 59b563bc3f10ed7d2438f6284f96478c592d3ddf /test/unit/temporary_user_test.rb | |
parent | a1d62a3a1492ca21e1e1d2344fac88bb4d93f324 (diff) | |
parent | 75c037e5d6d8b8f2b98477bdd0359f5687bd7517 (diff) |
Merge branch 'test/gitlab-ci' into 'develop'
[ci] get gitlab to run tests
See merge request !2
Diffstat (limited to 'test/unit/temporary_user_test.rb')
-rw-r--r-- | test/unit/temporary_user_test.rb | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/test/unit/temporary_user_test.rb b/test/unit/temporary_user_test.rb index 38ccd67..2c9e70f 100644 --- a/test/unit/temporary_user_test.rb +++ b/test/unit/temporary_user_test.rb @@ -6,16 +6,37 @@ class TemporaryUserTest < ActiveSupport::TestCase InviteCodeValidator.any_instance.stubs(:validate) end - test "tmp_user saved to tmp_users" do - begin - assert User.ancestors.include?(TemporaryUser) + test "TemporaryUser concern is applied" do + assert User.ancestors.include?(TemporaryUser) + end + + test "temporary user has tmp_users as db" do + tmp_user = User.new :login => 'tmp_user_'+SecureRandom.hex(5).downcase + assert_equal 'leap_web_tmp_users', tmp_user.database.name + end + test "normal user has users as db" do + user = User.new :login => 'a'+SecureRandom.hex(5).downcase + assert_equal 'leap_web_users', user.database.name + end + + test "user saved to users" do + begin assert_difference('User.database.info["doc_count"]') do normal_user = User.create!(:login => 'a'+SecureRandom.hex(5).downcase, :password_verifier => 'ABCDEF0010101', :password_salt => 'ABCDEF') refute normal_user.database.to_s.include?('tmp') end + ensure + begin + normal_user.destroy + rescue + end + end + end + test "tmp_user saved to tmp_users" do + begin assert_difference('User.tmp_database.info["doc_count"]') do tmp_user = User.create!(:login => 'tmp_user_'+SecureRandom.hex(5).downcase, :password_verifier => 'ABCDEF0010101', :password_salt => 'ABCDEF') @@ -23,7 +44,6 @@ class TemporaryUserTest < ActiveSupport::TestCase end ensure begin - normal_user.destroy tmp_user.destroy rescue end |