Sha256: 56e9af1c8366ff77b5a22f2e5d0c424f159218d05df30b0ab3e17a31df3685ce

Contents?: true

Size: 903 Bytes

Versions: 3

Compression:

Stored size: 903 Bytes

Contents

require "spec_helper"

module RockConfig
  describe Manager do
    let(:configuration) do
      configuration = Configuration.new
      configuration.scanned_directories << File.join(Dir.pwd, "spec", "fixtures")
      configuration.config_loaders << YamlLoader.new

      configuration
    end

    it "returns config if found" do
      manager = Manager.new(configuration)
      manager_result  = manager.fetch "database", "test"
      manager_result.should_not be_nil
    end

    it "raises error if the config doesnt have the environment"  do
      manager = Manager.new(configuration)
      manager_result  = manager.fetch "database", "development"

      expect do
        manager_result  = manager.fetch "database", "me no exist yo"
      end.to raise_error(EnvironmentNotFoundError,
                         'Environment "me no exist yo" not found for config file "database"')
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rock_config-0.0.7 spec/manager_spec.rb
rock_config-0.0.6 spec/manager_spec.rb
rock_config-0.0.5 spec/manager_spec.rb