Sha256: e951f7a2493551481a6072f3b2c64acd690927726c31a28b1ed586e14bfbb714

Contents?: true

Size: 1.05 KB

Versions: 8

Compression:

Stored size: 1.05 KB

Contents

require 'test_helper'

class Elasticsearch::Model::MultimodelTest < Test::Unit::TestCase

  context "Multimodel class" do
    setup do
      title  = stub('Foo', index_name: 'foo_index', document_type: 'foo')
      series = stub('Bar', index_name: 'bar_index', document_type: 'bar')
      @multimodel = Elasticsearch::Model::Multimodel.new(title, series)
    end

    should "have an index_name" do
      assert_equal ['foo_index', 'bar_index'], @multimodel.index_name
    end

    should "have a document_type" do
      assert_equal ['foo', 'bar'], @multimodel.document_type
    end

    should "have a client" do
      assert_equal Elasticsearch::Model.client, @multimodel.client
    end

    should "include models in the registry" do
      class ::JustAModel
        include Elasticsearch::Model
      end

      class ::JustAnotherModel
        include Elasticsearch::Model
      end

      multimodel = Elasticsearch::Model::Multimodel.new
      assert multimodel.models.include?(::JustAModel)
      assert multimodel.models.include?(::JustAnotherModel)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
elasticsearch-model-5.0.2 test/unit/multimodel_test.rb
elasticsearch-model-2.0.1 test/unit/multimodel_test.rb
elasticsearch-model-5.0.1 test/unit/multimodel_test.rb
elasticsearch-model-2.0.0 test/unit/multimodel_test.rb
elasticsearch-model-5.0.0 test/unit/multimodel_test.rb
elasticsearch-model-0.1.9 test/unit/multimodel_test.rb
elasticsearch-model-0.1.8 test/unit/multimodel_test.rb
elasticsearch-model-0.1.7 test/unit/multimodel_test.rb