Sha256: 7bf7e027a348a8cbd0a78285c98a80c004ec390966c7475bfa7f05603a601af2

Contents?: true

Size: 1.21 KB

Versions: 10

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

describe Waistband::Configuration do

  let(:config) { Waistband.config }

  it "loads config yml" do
    config.host.should match /http\:\/\//
    config.port.should eql 9200
    config.timeout.should eql 2
  end

  it "loads indexes config" do
    config.index('search').should be_a Hash
    config.index('search')['name'].should eql 'search_test'
    config.index('search')['settings']['index']['number_of_shards'].should eql 4
  end

  it "loads multiple indexes config" do
    config.index('events').should be_a Hash
    config.index('events')['name'].should eql 'events_test'
    config.index('events')['settings']['index']['number_of_shards'].should eql 4
  end

  describe '#servers' do

    it "returns array of all available servers' configs" do
      config.servers.should be_an Array
      config.servers.size.should eql 2

      config.servers.each_with_index do |server, i|
        server['host'].should match /http\:\/\//
        server['port'].should eql 9200

        server['_id'].should be_present
        server['_id'].length.should eql 40
      end
    end

    it "servers ids should be unique" do
      config.servers[0]['_id'].should_not eql config.servers[1]['_id']
    end

  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
waistband-0.7.4 spec/lib/configuration_spec.rb
waistband-0.7.3 spec/lib/configuration_spec.rb
waistband-0.7.1 spec/lib/configuration_spec.rb
waistband-0.7.0 spec/lib/configuration_spec.rb
waistband-0.4.2 spec/lib/configuration_spec.rb
waistband-0.4.1 spec/lib/configuration_spec.rb
waistband-0.4.0 spec/lib/configuration_spec.rb
waistband-0.3.2 spec/lib/configuration_spec.rb
waistband-0.3.1 spec/lib/configuration_spec.rb
waistband-0.3.0 spec/lib/configuration_spec.rb