Sha256: c0b92bed679b7815c5e5206096aac3665a1567c9e3a7fdd8ed66c1c1f3935e5e

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'

describe Dossier::Configuration do

  before :each do 
    Dossier.configure
    @config = Dossier.configuration
  end

  describe "defaults" do
    it "uses the rails configuration directory for the config path" do
      @config.config_path.should eq(Rails.root.join("config", "dossier.yml"))
    end
  end

  describe "client" do
    it "uses config/dossier.yml to setup the client" do
      options = YAML.load_file(Rails.root.join('config', 'dossier.yml'))[Rails.env].symbolize_keys
      expect(Dossier::Client).to receive(:new).with(options)
      Dossier.configure
    end

    it "will raise an exception if config/dossier.yml cannot be read" do
      config_path = Rails.root.join('config')
      FileUtils.mv config_path.join('dossier.yml'), config_path.join('dossier.yml.test')
      expect { Dossier.configure }.to raise_error(Dossier::ConfigurationMissingError)
      FileUtils.mv config_path.join('dossier.yml.test'), config_path.join('dossier.yml')
    end

    it "will setup the connection options" do
      @config.connection_options.should be_a(Hash)
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dossier-2.11.0 spec/dossier/configuration_spec.rb