Sha256: ea8465121df3d748b0bd54dc9a389e474a4a49a1be12015a48f67d3d8bfe1f40

Contents?: true

Size: 1.21 KB

Versions: 51

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

describe Acfs::Configuration do

  let(:cfg) { Acfs::Configuration.new }
  before { @configuration = Acfs::Configuration.current.dup }
  after { Acfs::Configuration.set @configuration }

  describe 'Acfs.configure' do
    it 'should invoke configure on current configuration' do
      Acfs::Configuration.current.should_receive(:configure).once.and_call_original

      Acfs.configure do |c|
        expect(c).to be_a Acfs::Configuration
      end
    end
  end

  describe '.load' do
    it 'should be able to load YAML' do
      cfg.configure do
        load 'spec/fixtures/config.yml'
      end

      expect(cfg.locate(UserService).to_s).to be == 'http://localhost:3001/'
      expect(cfg.locate(CommentService).to_s).to be == 'http://localhost:3002/'
    end

    context 'with RACK_ENV' do
      before { @env = ENV['RACK_ENV']; ENV['RACK_ENV'] = 'production' }
      after  { ENV['RACK_ENV'] = @env }

      it 'should load ENV block' do
        cfg.configure do
          load 'spec/fixtures/config.yml'
        end

        expect(cfg.locate(UserService).to_s).to be == 'http://user.example.org/'
        expect(cfg.locate(CommentService).to_s).to be == 'http://comment.example.org/'
      end
    end
  end
end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
acfs-0.25.0.1.b227 spec/acfs/configuration_spec.rb
acfs-0.25.0.1.b226 spec/acfs/configuration_spec.rb
acfs-0.25.0.1.b225 spec/acfs/configuration_spec.rb
acfs-0.25.0.1.b223 spec/acfs/configuration_spec.rb
acfs-0.25.0.1.b221 spec/acfs/configuration_spec.rb
acfs-0.25.0.1.b217 spec/acfs/configuration_spec.rb
acfs-0.25.0 spec/acfs/configuration_spec.rb
acfs-0.24.0.1.b216 spec/acfs/configuration_spec.rb
acfs-0.24.0.1.b214 spec/acfs/configuration_spec.rb
acfs-0.24.0.1.b212 spec/acfs/configuration_spec.rb
acfs-0.24.0.b210 spec/acfs/configuration_spec.rb
acfs-0.24.0 spec/acfs/configuration_spec.rb
acfs-0.23.2.b209 spec/acfs/configuration_spec.rb
acfs-0.23.2.b208 spec/acfs/configuration_spec.rb
acfs-0.23.2.b206 spec/acfs/configuration_spec.rb
acfs-0.23.2.b205 spec/acfs/configuration_spec.rb
acfs-0.23.2.b204 spec/acfs/configuration_spec.rb
acfs-0.23.2.b203 spec/acfs/configuration_spec.rb
acfs-0.23.2.b200 spec/acfs/configuration_spec.rb
acfs-0.23.2.b199 spec/acfs/configuration_spec.rb