summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/config/gitlab/couchdb.yml3
-rw-r--r--test/config/travis/couchdb.admin.yml (renamed from test/config/couchdb.admin.yml)3
-rw-r--r--test/config/travis/couchdb.yml (renamed from test/config/couchdb.yml)1
-rw-r--r--test/config/travis/ruby-version (renamed from test/travis/ruby-version)0
-rwxr-xr-xtest/config/travis/setup_couch.sh (renamed from test/travis/setup_couch.sh)0
-rw-r--r--test/unit/temporary_user_test.rb28
6 files changed, 28 insertions, 7 deletions
diff --git a/test/config/gitlab/couchdb.yml b/test/config/gitlab/couchdb.yml
new file mode 100644
index 0000000..68761dc
--- /dev/null
+++ b/test/config/gitlab/couchdb.yml
@@ -0,0 +1,3 @@
+test:
+ auto_update_design_doc: false
+ host: "couchdb"
diff --git a/test/config/couchdb.admin.yml b/test/config/travis/couchdb.admin.yml
index 0988bc1..a7677f9 100644
--- a/test/config/couchdb.admin.yml
+++ b/test/config/travis/couchdb.admin.yml
@@ -2,5 +2,4 @@ test:
auto_update_design_doc: false
username: "anna"
password: "secret"
- prefix: ""
-
+
diff --git a/test/config/couchdb.yml b/test/config/travis/couchdb.yml
index 9c8b67b..a57b888 100644
--- a/test/config/couchdb.yml
+++ b/test/config/travis/couchdb.yml
@@ -2,4 +2,3 @@ test:
auto_update_design_doc: false
username: "me"
password: "pwd"
- prefix: ""
diff --git a/test/travis/ruby-version b/test/config/travis/ruby-version
index 68b3a4c..68b3a4c 100644
--- a/test/travis/ruby-version
+++ b/test/config/travis/ruby-version
diff --git a/test/travis/setup_couch.sh b/test/config/travis/setup_couch.sh
index 0502c12..0502c12 100755
--- a/test/travis/setup_couch.sh
+++ b/test/config/travis/setup_couch.sh
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