Sha256: f9d453055ef67497a68f56d222e418c606bdaa9c31e7ba50ca18070058d0c7c2
Contents?: true
Size: 1.21 KB
Versions: 21
Compression:
Stored size: 1.21 KB
Contents
require 'test_helper' class Elasticsearch::Model::BaseTest < Test::Unit::TestCase context "Response base module" do class OriginClass def self.index_name; 'foo'; end def self.document_type; 'bar'; end end class DummyBaseClass include Elasticsearch::Model::Response::Base end RESPONSE = { 'hits' => { 'total' => 123, 'max_score' => 456, 'hits' => [] } } setup do @search = Elasticsearch::Model::Searching::SearchRequest.new OriginClass, '*' @response = Elasticsearch::Model::Response::Response.new OriginClass, @search @search.stubs(:execute!).returns(RESPONSE) end should "access klass, response, total and max_score" do r = DummyBaseClass.new OriginClass, @response assert_equal OriginClass, r.klass assert_equal @response, r.response assert_equal RESPONSE, r.response.response assert_equal 123, r.total assert_equal 456, r.max_score end should "have abstract methods results and records" do r = DummyBaseClass.new OriginClass, @response assert_raise(Elasticsearch::Model::NotImplemented) { |e| r.results } assert_raise(Elasticsearch::Model::NotImplemented) { |e| r.records } end end end
Version data entries
21 entries across 21 versions & 2 rubygems