Sha256: b1258dd62083d515439e1e7c72ded6814ff005b252b8851027b7378947bf4c58

Contents?: true

Size: 923 Bytes

Versions: 1

Compression:

Stored size: 923 Bytes

Contents

require "spec_helper"

module RockConfig
  describe YamlLoader do
    it "loads config when given valid path and filename" do
      directory = File.join(Dir.pwd, "spec", "fixtures") 

      loader = YamlLoader.new
      config = loader.find_at(directory, "database")

      config.should_not be_nil
    end

    it "evaluates erb expression within the file" do
      directory = File.join(Dir.pwd, "spec", "fixtures")

      ENV['magic_number'] = '213'
      loader = YamlLoader.new
      config = loader.find_at(directory, "database_erb")
      config.raw['development']['magic_number'].should eq(213)
    end

    it "throws exception when given valid path to an invalid file" do
      directory = File.join(Dir.pwd, "spec", "fixtures") 
      loader = YamlLoader.new

      expect do
        config = loader.find_at(directory, "database_invalid")
      end.to raise_error(RockConfig::ConfigLoadError)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rock_config-0.0.7 spec/yaml_loader_spec.rb