summaryrefslogtreecommitdiff
path: root/test/integration
diff options
context:
space:
mode:
authorjessib <jessib@riseup.net>2014-02-04 10:33:27 -0800
committerjessib <jessib@riseup.net>2014-02-04 10:33:27 -0800
commitc7f376cdc02fe10c7e2a51c7d52475ab34451577 (patch)
tree75c52cbbd43bb55d155c301855677fcba123a2c7 /test/integration
parentcda7ebacf35bcc0fcf233e5a23b958ed751fb108 (diff)
parentc3cb71ca5e6d32960e4493d85799f3706ea91fe8 (diff)
Merge pull request #9 from azul/test/integration-with-travis
Test/integration with travis
Diffstat (limited to 'test/integration')
-rw-r--r--test/integration/tapicero_test.rb37
-rw-r--r--test/integration/test_setup_test.rb15
2 files changed, 52 insertions, 0 deletions
diff --git a/test/integration/tapicero_test.rb b/test/integration/tapicero_test.rb
new file mode 100644
index 0000000..88e3715
--- /dev/null
+++ b/test/integration/tapicero_test.rb
@@ -0,0 +1,37 @@
+require_relative '../test_helper.rb'
+
+class TapiceroTest < Tapicero::IntegrationTest
+
+ def setup
+ create_user
+ end
+
+ def teardown
+ delete_user(true)
+ end
+
+ def test_creates_user_db
+ assert user_database
+ assert user_database.name.start_with?(config.options[:db_prefix])
+ assert user_database.info # ensure db exists in couch.
+ end
+
+ def test_configures_security
+ assert_equal config.options[:security], user_database.get('_security')
+ end
+
+ def test_stores_design_docs
+ assert_equal ['_design/docs', '_design/syncs', '_design/transactions'],
+ design_docs(user_database).map{|doc| doc["id"]}.sort
+ end
+
+ def test_cleares_user_db
+ assert user_database.info # ensure db exists in couch.
+ delete_user
+ assert !host.databases.include?(user_database.name)
+ end
+
+ def design_docs(db)
+ db.documents(startkey: '_design', endkey: '_design'.succ)["rows"]
+ end
+end
diff --git a/test/integration/test_setup_test.rb b/test/integration/test_setup_test.rb
new file mode 100644
index 0000000..525c14d
--- /dev/null
+++ b/test/integration/test_setup_test.rb
@@ -0,0 +1,15 @@
+require_relative '../test_helper.rb'
+
+class TestSetupTest < Tapicero::IntegrationTest
+
+ def test_loads_config
+ assert_equal "tapicero_test", config.connection[:prefix]
+ assert_equal "debug", config.send(:log_level)
+ end
+
+ def test_database_exists
+ assert database
+ assert_equal "tapicero_test_users", database.name
+ end
+
+end