Sha256: da50665a2f6c7381ad045e0fb14bb6c0a44ec44cbd148792e20c7f8ef0e68de2

Contents?: true

Size: 876 Bytes

Versions: 1

Compression:

Stored size: 876 Bytes

Contents

require File.expand_path('spec_helper', File.dirname(__FILE__))

require 'config_file'

describe ConfigFile do

  it "reads from yaml" do
    config = subject.load "spec/config/test_config.yaml"

    expect(config['property1']).to eq "value1"
    expect(config['property2']['property21']).to eq "value21"
  end

  it "reads from json" do
    config = subject.load "spec/config/test_config.json"

    expect(config['property1']).to eq "value1"
    expect(config['property2']['property21']).to eq "value21"
  end

  it "reads from ruby fragment" do
    config = subject.load "spec/config/test_config.rb"

    expect(config[:property1]).to eq "value1"
    expect(config[:property2][:property21]).to eq "value21"
  end

  it "raises exception for unsupported type" do
    expect {
      subject.load "spec/config/test_config.pdf"
    }.to raise_exception(ArgumentError)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
config-file-1.0.1 spec/config_file_spec.rb