Sha256: 972442a6a3a335a87b098cb4119e166053b7d8e211cffa35357a0657993c0389

Contents?: true

Size: 1.07 KB

Versions: 14

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'

describe ::Waistband::Result do

  let(:result_hash) do
    {
      "_index" => "bus_events",
      "_type" => "bus_event",
      "_id" => "a2081c0ce39b25d50b0a4be3c116ee7f",
      "_score" => nil,
      "_source" => {
        "bus_event_type" => "task_opened",
        "timeline_event" => "true",
        "_message" => "true"
      },
      "sort" => [nil]
    }
  end

  let(:result) { ::Waistband::Result.new(result_hash) }

  it "provides accessors for all default fields" do
    expect(result._id).to eql 'a2081c0ce39b25d50b0a4be3c116ee7f'
    expect(result._score).to be_nil
    expect(result._type).to eql 'bus_event'
    expect(result._index).to eql 'bus_events'
    expect(result.sort).to eql([nil])
    expect(result._source).to eql({
      "bus_event_type" => "task_opened",
      "timeline_event" => "true",
      "_message" => "true"
    })
  end

  it "provides method missing interface for the _source hash" do
    expect(result.bus_event_type).to eql 'task_opened'
    expect(result.timeline_event).to be_true
    expect(result._message).to be_true
  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
waistband-0.11.2 spec/lib/result_spec.rb
waistband-0.11.1 spec/lib/result_spec.rb
waistband-0.11.0 spec/lib/result_spec.rb
waistband-0.10.0 spec/lib/result_spec.rb
waistband-0.9.9 spec/lib/result_spec.rb
waistband-0.9.8 spec/lib/result_spec.rb
waistband-0.9.7 spec/lib/result_spec.rb
waistband-0.9.6 spec/lib/result_spec.rb
waistband-0.9.5 spec/lib/result_spec.rb
waistband-0.9.4 spec/lib/result_spec.rb
waistband-0.9.3 spec/lib/result_spec.rb
waistband-0.9.2 spec/lib/result_spec.rb
waistband-0.9.1 spec/lib/result_spec.rb
waistband-0.9.0 spec/lib/result_spec.rb