Sha256: 00f0fb657f4871836c144bc096ac15bf6a8fb7f6e68c94d3b49aa56083e4bd4a

Contents?: true

Size: 883 Bytes

Versions: 5

Compression:

Stored size: 883 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.should == :development
    app.environment = :test
    app.environment.should == :test
    
    app.plugin :environments, :production
    app.environment.should == :production
  end

  it "adds predicates for testing the environment" do
    app.development?.should == true
    app.test?.should == false
    app.production?.should == 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.should == [1, app]
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
roda-2.2.0 spec/plugin/environments_spec.rb
roda-2.1.0 spec/plugin/environments_spec.rb
roda-2.0.0 spec/plugin/environments_spec.rb
roda-1.3.0 spec/plugin/environments_spec.rb
roda-1.2.0 spec/plugin/environments_spec.rb