Sha256: 0a381bd0957c15d24fbc958158ee49ae2a4d2ca6887dbae15ee3e70b1c580f0b

Contents?: true

Size: 906 Bytes

Versions: 6

Compression:

Stored size: 906 Bytes

Contents

require 'spec_helper'

describe App do
  describe 'config' do
    let (:klass) do
      mock_app_class do
        get '/' do
          p config
          config.foo.should == 'bar'
        end
      end
    end

    let (:app) do
      Rack::MockRequest.new(klass.new)
    end

    it 'sets any property' do
      klass.config.foo = 'bar'
      klass.config.foo.should == 'bar'
    end

    it 'can configure multiple environments at once' do
      NYNY.stub :env => ['development', 'test'].sample

      kls = mock_app_class do
        configure :development, :test do
          config.test_dev = true
        end
      end

      kls.config.test_dev.should == true
      NYNY.unstub :env
    end

    it 'configures all environments by default' do
      kls = mock_app_class do
        configure do
          config.foo = true
        end
      end

      kls.config.foo.should == true
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
nyny-3.4.3 spec/config_spec.rb
nyny-3.4.2 spec/config_spec.rb
nyny-3.4.1 spec/config_spec.rb
nyny-3.4.0 spec/config_spec.rb
nyny-3.3.1 spec/config_spec.rb
nyny-3.3.0 spec/config_spec.rb