Sha256: b2fab654fc235f071c4f813a6680f3a1f2d04259153ce31ce07a9ac836f2875e

Contents?: true

Size: 890 Bytes

Versions: 2

Compression:

Stored size: 890 Bytes

Contents

require File.expand_path("spec_helper", File.dirname(File.dirname(__FILE__)))

describe "environments plugin" do 
  before do
    app
    app.plugin :environments, :development
  end

  it "adds environment accessor for getting/setting the environment" do
    app.environment.must_equal :development
    app.environment = :test
    app.environment.must_equal :test
    
    app.plugin :environments, :production
    app.environment.must_equal :production
  end

  it "adds predicates for testing the environment" do
    app.development?.must_equal true
    app.test?.must_equal false
    app.production?.must_equal false
  end

  it "adds configure method which yields if no arguments are given or an environment matches" do
    a = []
    app.configure{a << 1}
    app.configure(:development){|ap| a << ap}
    app.configure(:test, :production){a << 2}
    a.must_equal [1, app]
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
roda-2.4.0 spec/plugin/environments_spec.rb
roda-2.3.0 spec/plugin/environments_spec.rb