summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2015-10-08 14:10:00 +0200
committerChristoph Helma <helma@in-silico.ch>2015-10-08 14:10:00 +0200
commit596ef28dea32baa37b47fa5b82bdc4649ca69382 (patch)
tree4a21f548adeab168276d237871cc19b4dede6836 /test
parent1a56148aadef031c4f487bc23fda43f4ac5b7369 (diff)
new environment variable LAZAR_ENV for databases and log levels
Diffstat (limited to 'test')
-rw-r--r--test/default_environment.rb11
-rw-r--r--test/setup.rb5
-rw-r--r--test/test_environment.rb10
3 files changed, 23 insertions, 3 deletions
diff --git a/test/default_environment.rb b/test/default_environment.rb
new file mode 100644
index 0000000..7c2a2f5
--- /dev/null
+++ b/test/default_environment.rb
@@ -0,0 +1,11 @@
+require 'minitest/autorun'
+require_relative '../lib/lazar.rb'
+include OpenTox
+class DefaultEnvironmentTest < MiniTest::Test
+ def test_lazar_environment
+ assert_equal "production", ENV["LAZAR_ENV"]
+ assert_equal "production", ENV["MONGOID_ENV"]
+ assert_equal "production", ENV["RACK_ENV"]
+ assert_equal "production", Mongoid.clients["default"]["database"]
+ end
+end
diff --git a/test/setup.rb b/test/setup.rb
index ba1b7af..3825282 100644
--- a/test/setup.rb
+++ b/test/setup.rb
@@ -1,9 +1,8 @@
+ENV["LAZAR_ENV"] = "development"
require 'minitest/autorun'
require_relative '../lib/lazar.rb'
include OpenTox
TEST_DIR ||= File.expand_path(File.dirname(__FILE__))
DATA_DIR ||= File.join(TEST_DIR,"data")
-Mongoid.configure.connect_to("test")
-$mongo = Mongo::Client.new('mongodb://127.0.0.1:27017/test')
#$mongo.database.drop
-$gridfs = $mongo.database.fs
+#$gridfs = $mongo.database.fs
diff --git a/test/test_environment.rb b/test/test_environment.rb
new file mode 100644
index 0000000..4c2af95
--- /dev/null
+++ b/test/test_environment.rb
@@ -0,0 +1,10 @@
+require_relative "setup.rb"
+
+class EnvironmentTest < MiniTest::Test
+ def test_lazar_environment
+ assert_equal "development", ENV["LAZAR_ENV"]
+ assert_equal "development", ENV["MONGOID_ENV"]
+ assert_equal "development", ENV["RACK_ENV"]
+ assert_equal "development", Mongoid.clients["default"]["database"]
+ end
+end