Sha256: fb74ce8b58cdb9d620eb91da2219703519bd94053341ba8bdbc6a0139539b057

Contents?: true

Size: 913 Bytes

Versions: 1

Compression:

Stored size: 913 Bytes

Contents

# encoding: UTF-8

require 'spec_helper'

describe Esearch::Type do
  let(:object)     { described_class.new(index, type_name)   }
  let(:index)      { double('Index', connection: connection) }
  let(:connection) { double('Connection')                    }
  let(:type_name)  { double('Type Name')                     }

  describe '#connection' do
    subject { object.connection }

    it { should be(connection) }

    it_should_behave_like 'an idempotent method'
  end

  describe '#document' do
    subject { object.document(id) }

    let(:id)        { double('ID') }

    it { should eql(Esearch::Document.new(object, id)) }
  end

  describe '#path' do
    let(:type_name) { 'type-foo' }
    let(:index)     { double('Index', path: Pathname.new('a-index')) }

    subject { object.path }

    it { should eql(Pathname.new('a-index/type-foo')) }

    it_should_behave_like 'an idempotent method'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
esearch-0.2.2 spec/unit/esearch/type_spec.rb