Sha256: 05e091d97935efad2cda0de7ca5c3505a806d12d3c6d4dda8bcc3ec8c83c9467

Contents?: true

Size: 1.22 KB

Versions: 63

Compression:

Stored size: 1.22 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
      expect(Acfs::Configuration.current).to 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

63 entries across 63 versions & 1 rubygems

Version Path
acfs-0.42.0 spec/acfs/configuration_spec.rb
acfs-0.41.1 spec/acfs/configuration_spec.rb
acfs-0.41.1.beta1 spec/acfs/configuration_spec.rb
acfs-0.41.0 spec/acfs/configuration_spec.rb
acfs-0.40.1.rc1 spec/acfs/configuration_spec.rb
acfs-0.40.0 spec/acfs/configuration_spec.rb
acfs-0.39.1 spec/acfs/configuration_spec.rb
acfs-0.39.0 spec/acfs/configuration_spec.rb
acfs-1.0.0.dev.1.b305 spec/acfs/configuration_spec.rb
acfs-0.38.0 spec/acfs/configuration_spec.rb
acfs-1.0.0.dev.1.b298 spec/acfs/configuration_spec.rb
acfs-1.0.0.dev.1.b297 spec/acfs/configuration_spec.rb
acfs-0.37.0.1.b295 spec/acfs/configuration_spec.rb
acfs-0.37.0 spec/acfs/configuration_spec.rb
acfs-0.36.0.1.b293 spec/acfs/configuration_spec.rb
acfs-0.36.0 spec/acfs/configuration_spec.rb
acfs-0.35.0.1.b291 spec/acfs/configuration_spec.rb
acfs-0.35.0 spec/acfs/configuration_spec.rb
acfs-0.34.1.1.b289 spec/acfs/configuration_spec.rb
acfs-0.34.1 spec/acfs/configuration_spec.rb