Sha256: ddc38c7fc2ed297a4841c435ea014f330e8c86e928e5cf25be6294d750b9cbeb
Contents?: true
Size: 1.9 KB
Versions: 4
Compression:
Stored size: 1.9 KB
Contents
require File.join(File.dirname(__FILE__), "test_helper.rb") class EnvironmentTest < Scope::TestCase setup do Ecology.reset end context "with environment-from in your ecology" do setup do set_up_ecology <<ECOLOGY_CONTENTS { "application": "SomeApp", "environment-from": ["SOME_ENV_VAR", "VAR2"] } ECOLOGY_CONTENTS ENV["SOME_ENV_VAR"] = ENV["VAR2"] = nil end should "default to the development environment" do Ecology.read assert_equal "development", Ecology.environment end should "use the environment variables to determine environment" do ENV["SOME_ENV_VAR"] = "staging" Ecology.read assert_equal "staging", Ecology.environment end should "use secondary environment variables when the primary isn't set" do ENV["VAR2"] = "daily-staging" Ecology.read assert_equal "daily-staging", Ecology.environment end should "use primary environment variables in preference to secondary" do ENV["SOME_ENV_VAR"] = "theatrical staging" ENV["VAR2"] = "daily-staging" Ecology.read assert_equal "theatrical staging", Ecology.environment end end context "with an environment override in your ecology" do setup do set_up_ecology <<ECOLOGY_CONTENTS { "application": "SomeApp", "environment": "not really staging", "environment-from": "SOME_ENV_VAR" } ECOLOGY_CONTENTS end should "use the environment override" do Ecology.read assert_equal "not really staging", Ecology.environment end end context "with a single environment-from in your ecology" do setup do set_up_ecology <<ECOLOGY_CONTENTS { "application": "SomeApp", "environment-from": "SOME_ENV_VAR" } ECOLOGY_CONTENTS end should "use the environment override" do ENV['SOME_ENV_VAR'] = "bob's pants" Ecology.read assert_equal "bob's pants", Ecology.environment end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ecology-0.0.18 | test/environment_test.rb |
ecology-0.0.14 | test/environment_test.rb |
ecology-0.0.12 | test/environment_test.rb |
ecology-0.0.11 | test/environment_test.rb |