elasticsearch-model 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,7 +7,8 @@ class Elasticsearch::Model::ResponseTest < Test::Unit::TestCase
7
7
  def self.document_type; 'bar'; end
8
8
  end
9
9
 
10
- RESPONSE = { 'took' => '5', 'timed_out' => false, '_shards' => {'one' => 'OK'}, 'hits' => { 'hits' => [] } }
10
+ RESPONSE = { 'took' => '5', 'timed_out' => false, '_shards' => {'one' => 'OK'}, 'hits' => { 'hits' => [] },
11
+ 'aggregations' => {'foo' => {'bar' => 10}}}
11
12
 
12
13
  setup do
13
14
  @search = Elasticsearch::Model::Searching::SearchRequest.new OriginClass, '*'
@@ -63,5 +64,14 @@ class Elasticsearch::Model::ResponseTest < Test::Unit::TestCase
63
64
 
64
65
  Elasticsearch::Model::Response::Response.new OriginClass, @search
65
66
  end
67
+
68
+ should "access the aggregations" do
69
+ @search.expects(:execute!).returns(RESPONSE)
70
+
71
+ response = Elasticsearch::Model::Response::Response.new OriginClass, @search
72
+ assert_respond_to response, :aggregations
73
+ assert_kind_of Hashie::Mash, response.aggregations.foo
74
+ assert_equal 10, response.aggregations.foo.bar
75
+ end
66
76
  end
67
77
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch-model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karel Minarik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-08 00:00:00.000000000 Z
11
+ date: 2015-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: elasticsearch
@@ -336,6 +336,7 @@ files:
336
336
  - elasticsearch-model.gemspec
337
337
  - examples/activerecord_article.rb
338
338
  - examples/activerecord_associations.rb
339
+ - examples/activerecord_mapping_completion.rb
339
340
  - examples/couchbase_article.rb
340
341
  - examples/datamapper_article.rb
341
342
  - examples/mongoid_article.rb
@@ -376,6 +377,8 @@ files:
376
377
  - test/integration/dynamic_index_name_test.rb
377
378
  - test/integration/mongoid_basic_test.rb
378
379
  - test/integration/multiple_models_test.rb
380
+ - test/support/model.json
381
+ - test/support/model.yml
379
382
  - test/test_helper.rb
380
383
  - test/unit/adapter_active_record_test.rb
381
384
  - test/unit/adapter_default_test.rb
@@ -436,6 +439,8 @@ test_files:
436
439
  - test/integration/dynamic_index_name_test.rb
437
440
  - test/integration/mongoid_basic_test.rb
438
441
  - test/integration/multiple_models_test.rb
442
+ - test/support/model.json
443
+ - test/support/model.yml
439
444
  - test/test_helper.rb
440
445
  - test/unit/adapter_active_record_test.rb
441
446
  - test/unit/adapter_default_test.rb