Sha256: 41a0539f5e6de4089e44986d1344bf2b56ceb83d54a28316318bf9618be2ef99

Contents?: true

Size: 564 Bytes

Versions: 4

Compression:

Stored size: 564 Bytes

Contents

require_relative "../lib/tynn/environment"

test "use RACK_ENV by default" do
  begin
    old, ENV["RACK_ENV"] = ENV["RACK_ENV"], "production"

    Tynn.plugin(Tynn::Environment)

    assert_equal(:production, Tynn.environment)

    assert !Tynn.development?
    assert !Tynn.test?
    assert Tynn.production?

  ensure
    ENV["RACK_ENV"] = old
  end
end

test "use custom value" do
  Tynn.plugin(Tynn::Environment, env: "development")

  assert_equal(:development, Tynn.environment)
  assert Tynn.development?
  assert !Tynn.test?
  assert !Tynn.production?
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tynn-1.4.0 test/environment_test.rb
tynn-1.3.0 test/environment_test.rb
tynn-1.2.0 test/environment_test.rb
tynn-1.1.0 test/environment_test.rb