Sha256: 54efe12775d88ad477208e6b77b413094b51018e4fd74faaeb2f26d799b5f607

Contents?: true

Size: 1.8 KB

Versions: 6

Compression:

Stored size: 1.8 KB

Contents

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

describe "Merb" do

  describe "Merb.environment, Merb.env helpers" do
    before(:all) do
      startup_merb
      @orig_env = Merb.environment
    end
    after(:all) do
      Merb.environment = @orig_env
    end

    it "should pickup the environment from env" do
      %w(development test production staging demo).each do |e|
        Merb.environment = e
        Merb.env.should == e
      end
    end

    it "should correctly answer the question about which env it's in with symbol or string" do
      %w(development test production staging demo custom).each do |e|
        Merb.environment = e
        Merb.env?(e).should be true
        Merb.env?(e.to_sym).should be_true
      end
    end

    it "should answer false if asked for an environment that is not current" do
      %w(development test production staging demo custom).each do |e|
        Merb.environment = e
        Merb.env?(:not_it).should be_false
      end
    end

    it "should allow an environment to merge another environments settings" do
      %w(development test production staging demo custom).each do |e|

        Merb.environment = e
        Merb.start_environment
        Merb.merge_env "some_other_env"
        Merb.environment_info.nil?.should be_false
        Merb.environment_info[:merged_envs].first.should == "some_other_env"
      end
    end
  end

  describe "#runnig_irb?" do
    it "should be false if running different adapter than irb" do
      startup_merb
      Merb.running_irb?.should be_false
    end

    %w{-i --irb-console}.each do |option|
      it "should be true if merb is run with CLI option #{option}" do
        Merb::Server.stub!(:start)
        Merb.start([option])
        Merb.running_irb?.should be_true
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
merb-core-1.1.3 spec/public/core/merb_core_spec.rb
merb-core-1.1.2 spec/public/core/merb_core_spec.rb
merb-core-1.1.1 spec/public/core/merb_core_spec.rb
merb-core-1.1.0 spec/public/core/merb_core_spec.rb
merb-core-1.1.0.rc1 spec/public/core/merb_core_spec.rb
merb-core-1.1.0.pre spec/public/core/merb_core_spec.rb