Sha256: 6ae227f68c9622d02fde45a90ce63876ff4ca6177ecc14a69c4b92f02ac728da

Contents?: true

Size: 1.12 KB

Versions: 5

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'

describe MultiConfig::ORMs::ActiveRecord::Config do
  describe '#path' do
    before do
      Rails.stub(:root).and_return('/')
    end
    subject { MultiConfig::ORMs::ActiveRecord::Config.path('other_db.yml') }
    it { should == '/config/other_db.yml' }
  end

  describe '#load' do
    let!(:db_config) { load_namespaced_config('database.yml') }
    let!(:other_config) { load_namespaced_config('other.yml') }
    let!(:erb_config) { load_namespaced_config('erb.yml') }

    it "should load yaml and erb/yaml files correctly" do
      MultiConfig::ORMs::ActiveRecord::Config.load('other.yml', 'other').should == other_config
      MultiConfig::ORMs::ActiveRecord::Config.load('erb.yml', 'erb').should == erb_config
    end

    it "should raise an error if file is not in present" do
      lambda { MultiConfig::ORMs::ActiveRecord::Config.load('none.yml', 'none') }.should raise_error(RuntimeError)
    end

    it "should raise an error when I specify invalid config file" do
      lambda { MultiConfig::ORMs::ActiveRecord::Config.load('invalid.yml', 'invalid') }.should raise_error(RuntimeError)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
multi_config-1.0.0 spec/active_record/config_spec.rb
multi_config-0.2.2 spec/active_record/config_spec.rb
multi_config-0.2.0 spec/active_record/config_spec.rb
multi_config-0.1.9 spec/active_record/config_spec.rb
multi_config-0.1.8 spec/active_record/config_spec.rb