Sha256: 876e5815a72914d02210c5be3523ed904293895cb7f0a27327b975e499064ed8

Contents?: true

Size: 980 Bytes

Versions: 7

Compression:

Stored size: 980 Bytes

Contents

require 'spec_helper'

describe Waistband::Index do

  let(:index) { Waistband::Index.new('multi_connection_events') }
  let(:client) { index.client }

  it "grabs connection data from the index's settings" do
    expect(client).to be_a(::Waistband::Client)
    expect(client.connection).to be_a(::Elasticsearch::Transport::Client)
    expect(client.instance_variable_get('@servers')).to eql({"server1"=>{"host"=>"127.0.0.1", "port"=>9200, "protocol"=>"http"}})
  end

  it "correctly sets hosts" do
    expect(client.send(:config_hash)[:hosts]).to eql([{"host"=>"127.0.0.1", "port"=>9200, "protocol"=>"http"}])
  end

  it "exposes servers correctly" do
    expect(client.servers).to eql({"server1"=>{"host"=>"127.0.0.1", "port"=>9200, "protocol"=>"http"}})
  end

  it "works" do
    index.delete
    index.create
    saved = index.save('testing123', {ok: 'yeah'})
    index.refresh
    data = index.read('testing123')
    expect(data['_source']['ok']).to eql 'yeah'
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
waistband-6.1.1 spec/lib/index_multi_connection_spec.rb
waistband-6.1.0 spec/lib/index_multi_connection_spec.rb
waistband-6.0.0 spec/lib/index_multi_connection_spec.rb
waistband-0.16.7 spec/lib/index_multi_connection_spec.rb
waistband-0.16.6 spec/lib/index_multi_connection_spec.rb
waistband-0.16.5 spec/lib/index_multi_connection_spec.rb
waistband-0.16.3 spec/lib/index_multi_connection_spec.rb