esearch 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +5 -6
- data/Changelog.md +4 -0
- data/Gemfile +1 -1
- data/Gemfile.devtools +36 -29
- data/circle.yml +7 -0
- data/config/mutant.yml +1 -1
- data/esearch.gemspec +4 -4
- data/lib/esearch.rb +1 -0
- data/lib/esearch/cluster.rb +1 -1
- data/lib/esearch/connection.rb +1 -1
- data/lib/esearch/request.rb +1 -1
- data/spec/spec_helper.rb +7 -7
- data/spec/unit/esearch/cluster/class_methods/connect_spec.rb +3 -3
- data/spec/unit/esearch/cluster/index_spec.rb +1 -1
- data/spec/unit/esearch/cluster/indices_spec.rb +1 -1
- data/spec/unit/esearch/cluster/path_spec.rb +1 -1
- data/spec/unit/esearch/command/class_methods/run_spec.rb +3 -3
- data/spec/unit/esearch/command/cluster/health/run_spec.rb +3 -3
- data/spec/unit/esearch/command/document/index/create/run_spec.rb +4 -4
- data/spec/unit/esearch/command/document/index/run_create_spec.rb +4 -4
- data/spec/unit/esearch/command/document/index/run_spec.rb +3 -3
- data/spec/unit/esearch/command/document/index/run_update_spec.rb +3 -3
- data/spec/unit/esearch/command/document/index/update/run_spec.rb +3 -3
- data/spec/unit/esearch/command/exist/result_spec.rb +3 -3
- data/spec/unit/esearch/command/index/create/run_spec.rb +3 -3
- data/spec/unit/esearch/command/result_spec.rb +3 -3
- data/spec/unit/esearch/command/search/run_spec.rb +1 -1
- data/spec/unit/esearch/connection/class_methods/build_spec.rb +3 -3
- data/spec/unit/esearch/connection/run_spec.rb +6 -6
- data/spec/unit/esearch/document/connection_spec.rb +4 -4
- data/spec/unit/esearch/document/delete_spec.rb +1 -1
- data/spec/unit/esearch/document/get_spec.rb +1 -1
- data/spec/unit/esearch/index/type_spec.rb +1 -1
- data/spec/unit/esearch/indices/all/path_spec.rb +2 -2
- data/spec/unit/esearch/mixin/document/index_create_spec.rb +3 -3
- data/spec/unit/esearch/mixin/document/index_spec.rb +3 -3
- data/spec/unit/esearch/mixin/document/index_update_spec.rb +3 -3
- data/spec/unit/esearch/mixin/search/search_spec.rb +1 -1
- data/spec/unit/esearch/presenter/aspect/range/from_spec.rb +3 -3
- data/spec/unit/esearch/presenter/aspect/range/to_spec.rb +3 -3
- data/spec/unit/esearch/presenter/class_methods/new_spec.rb +2 -2
- data/spec/unit/esearch/presenter/hit/fields_spec.rb +3 -3
- data/spec/unit/esearch/presenter/hit/source_spec.rb +3 -3
- data/spec/unit/esearch/presenter/hits/each_spec.rb +3 -3
- data/spec/unit/esearch/presenter/hits/size_spec.rb +3 -3
- data/spec/unit/esearch/request/initialize_spec.rb +4 -4
- data/spec/unit/esearch/request/run_spec.rb +4 -4
- data/spec/unit/esearch/type/connection_spec.rb +4 -4
- data/spec/unit/esearch/type/document_spec.rb +1 -1
- metadata +13 -30
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f9b692861635b707f91c0371e112ecb747b3fe13
|
4
|
+
data.tar.gz: 9503faf8f4b82942200e6839050b2718b8d2050f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ad35c0ed296e7156c5ede3098b315b93567419a41a1fe91ef770120086472f8e61b4bcee9e8dec53ba1edf1576b5d89df616a2911fe31416f7119bd15246b06e
|
7
|
+
data.tar.gz: a3bae467d4bab97f35a0a29db064ca3e56751710fff870a11311b9b82a460ed35a8686c7f8cbdea239c0d1e086490dfaacf21b7289066e0d1bf5403c6d1a3e69
|
data/.travis.yml
CHANGED
@@ -10,10 +10,9 @@ rvm:
|
|
10
10
|
- jruby-19mode
|
11
11
|
- jruby-head
|
12
12
|
- rbx-19mode
|
13
|
-
matrix:
|
14
|
-
allow_failures:
|
15
|
-
- rvm: rbx-18mode # Json lib is defunct
|
16
13
|
notifications:
|
17
|
-
irc:
|
18
|
-
|
19
|
-
|
14
|
+
irc:
|
15
|
+
channels:
|
16
|
+
- irc.freenode.org#rom-rb
|
17
|
+
on_success: never
|
18
|
+
on_failure: change
|
data/Changelog.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.devtools
CHANGED
@@ -1,51 +1,58 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
group :development do
|
4
|
-
gem 'rake', '~> 10.0
|
5
|
-
gem 'rspec', '~> 2.
|
6
|
-
gem 'yard', '~> 0.8.
|
4
|
+
gem 'rake', '~> 10.1.0'
|
5
|
+
gem 'rspec', '~> 2.14.1'
|
6
|
+
gem 'yard', '~> 0.8.7'
|
7
|
+
|
8
|
+
platform :rbx do
|
9
|
+
gem 'rubysl-singleton', '~> 2.0.0'
|
10
|
+
end
|
7
11
|
end
|
8
12
|
|
9
13
|
group :yard do
|
10
|
-
gem 'kramdown', '~> 1.0
|
14
|
+
gem 'kramdown', '~> 1.3.0'
|
11
15
|
end
|
12
16
|
|
13
17
|
group :guard do
|
14
|
-
gem 'guard', '~>
|
15
|
-
gem 'guard-bundler', '~>
|
16
|
-
gem 'guard-rspec', '~> 2.
|
18
|
+
gem 'guard', '~> 2.2.4'
|
19
|
+
gem 'guard-bundler', '~> 2.0.0'
|
20
|
+
gem 'guard-rspec', '~> 4.2.0'
|
21
|
+
gem 'guard-rubocop', '~> 1.0.0'
|
17
22
|
|
18
23
|
# file system change event handling
|
19
|
-
gem 'listen', '~>
|
20
|
-
gem 'rb-fchange', '~> 0.0.6', :
|
21
|
-
gem 'rb-fsevent', '~> 0.9.3', :
|
22
|
-
gem 'rb-inotify', '~> 0.9.0', :
|
24
|
+
gem 'listen', '~> 2.4.0'
|
25
|
+
gem 'rb-fchange', '~> 0.0.6', require: false
|
26
|
+
gem 'rb-fsevent', '~> 0.9.3', require: false
|
27
|
+
gem 'rb-inotify', '~> 0.9.0', require: false
|
23
28
|
|
24
29
|
# notification handling
|
25
|
-
gem 'libnotify', '~> 0.8.0', :
|
26
|
-
gem 'rb-notifu', '~> 0.0.4', :
|
27
|
-
gem 'terminal-notifier-guard', '~> 1.5.3', :
|
30
|
+
gem 'libnotify', '~> 0.8.0', require: false
|
31
|
+
gem 'rb-notifu', '~> 0.0.4', require: false
|
32
|
+
gem 'terminal-notifier-guard', '~> 1.5.3', require: false
|
28
33
|
end
|
29
34
|
|
30
35
|
group :metrics do
|
31
|
-
gem '
|
32
|
-
gem '
|
33
|
-
gem '
|
34
|
-
gem '
|
35
|
-
gem '
|
36
|
-
gem 'simplecov',
|
37
|
-
gem 'yardstick',
|
38
|
-
|
39
|
-
platforms :ruby_19 do
|
40
|
-
gem 'yard-spellcheck', '~> 0.1.5'
|
41
|
-
end
|
36
|
+
gem 'coveralls', '~> 0.7.0'
|
37
|
+
gem 'flay', '~> 2.4.0'
|
38
|
+
gem 'flog', '~> 4.2.0'
|
39
|
+
gem 'reek', '~> 1.3.2'
|
40
|
+
gem 'rubocop', '~> 0.16.0'
|
41
|
+
gem 'simplecov', '~> 0.8.2'
|
42
|
+
gem 'yardstick', '~> 0.9.7', git: 'https://github.com/dkubb/yardstick.git'
|
42
43
|
|
43
|
-
platforms :
|
44
|
-
gem 'mutant',
|
44
|
+
platforms :ruby_19, :ruby_20 do
|
45
|
+
gem 'mutant', '~> 0.3.0', git: 'https://github.com/mbj/mutant.git'
|
46
|
+
gem 'unparser', '~> 0.1.5', git: 'https://github.com/mbj/unparser.git'
|
47
|
+
gem 'yard-spellcheck', '~> 0.1.5'
|
45
48
|
end
|
46
49
|
|
47
|
-
|
48
|
-
gem '
|
50
|
+
platform :rbx do
|
51
|
+
gem 'json', '~> 1.8.1'
|
52
|
+
gem 'racc', '~> 1.4.10'
|
53
|
+
gem 'rubysl-logger', '~> 2.0.0'
|
54
|
+
gem 'rubysl-open-uri', '~> 2.0.0'
|
55
|
+
gem 'rubysl-prettyprint', '~> 2.0.2'
|
49
56
|
end
|
50
57
|
end
|
51
58
|
|
data/circle.yml
ADDED
data/config/mutant.yml
CHANGED
data/esearch.gemspec
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.name = 'esearch'
|
5
|
-
gem.version = '0.2.
|
5
|
+
gem.version = '0.2.1'
|
6
6
|
gem.authors = [ 'Markus Schirp' ]
|
7
|
-
gem.email = [ 'mbj@
|
7
|
+
gem.email = [ 'mbj@schirp-dso.com' ]
|
8
8
|
gem.description = 'Esearch driver for ruby'
|
9
9
|
gem.summary = gem.description
|
10
10
|
gem.homepage = 'https://github.com/mbj/elasticsearch'
|
@@ -18,9 +18,9 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.add_runtime_dependency('descendants_tracker', '~> 0.0.1')
|
19
19
|
gem.add_runtime_dependency('concord', '~> 0.1.0')
|
20
20
|
gem.add_runtime_dependency('faraday', '~> 0.8.4')
|
21
|
-
gem.add_runtime_dependency('adamantium', '~> 0.0
|
21
|
+
gem.add_runtime_dependency('adamantium', '~> 0.1.0')
|
22
22
|
gem.add_runtime_dependency('equalizer', '~> 0.0.5')
|
23
23
|
gem.add_runtime_dependency('abstract_type', '~> 0.0.5')
|
24
|
-
gem.add_runtime_dependency('multi_json', '~> 1.
|
24
|
+
gem.add_runtime_dependency('multi_json', '~> 1.8.2')
|
25
25
|
gem.add_runtime_dependency('null_logger', '~> 0.0.1')
|
26
26
|
end
|
data/lib/esearch.rb
CHANGED
data/lib/esearch/cluster.rb
CHANGED
data/lib/esearch/connection.rb
CHANGED
data/lib/esearch/request.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -7,8 +7,8 @@ module CommandHelper
|
|
7
7
|
module ClassMethods
|
8
8
|
|
9
9
|
def expect_to_run_command(command)
|
10
|
-
let(:connection) {
|
11
|
-
let(:result) {
|
10
|
+
let(:connection) { double('Connection') }
|
11
|
+
let(:result) { double('Result') }
|
12
12
|
|
13
13
|
before do
|
14
14
|
command.should_receive(:run).with(object, *expected_arguments).and_return(result)
|
@@ -18,11 +18,11 @@ module CommandHelper
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def setup_connection
|
21
|
-
let(:context) {
|
22
|
-
let(:connection) {
|
21
|
+
let(:context) { double('Context', :connection => connection, :path => Pathname.new('/foo')) }
|
22
|
+
let(:connection) { double('Connection') }
|
23
23
|
|
24
24
|
let(:headers) { {'content-type' => 'application/json; charset=UTF-8'} }
|
25
|
-
let(:response) {
|
25
|
+
let(:response) { double('Response', :frozen? => true, :status => status, :headers => headers, :body => '{}') }
|
26
26
|
|
27
27
|
let(:status) { 200 }
|
28
28
|
|
@@ -33,7 +33,7 @@ module CommandHelper
|
|
33
33
|
|
34
34
|
def expect_exception(exception)
|
35
35
|
setup_connection
|
36
|
-
|
36
|
+
|
37
37
|
yield if block_given?
|
38
38
|
|
39
39
|
it 'should raise error' do
|
@@ -49,7 +49,7 @@ module CommandHelper
|
|
49
49
|
it { should eql(result) }
|
50
50
|
end
|
51
51
|
|
52
|
-
def expect_presenter(presenter, &block)
|
52
|
+
def expect_presenter(presenter, &block)
|
53
53
|
expect_result(presenter.new({}), &block)
|
54
54
|
end
|
55
55
|
end
|
@@ -3,11 +3,11 @@ require 'spec_helper'
|
|
3
3
|
describe Esearch::Cluster, '.connect' do
|
4
4
|
subject { object.connect(*arguments) }
|
5
5
|
|
6
|
-
let(:object) { described_class
|
7
|
-
let(:connection) {
|
6
|
+
let(:object) { described_class }
|
7
|
+
let(:connection) { double('Connection') }
|
8
8
|
|
9
9
|
let(:arguments) { [:foo, :bar] }
|
10
|
-
|
10
|
+
|
11
11
|
before do
|
12
12
|
Esearch::Connection.should_receive(:build).with(:foo, :bar).and_return(connection)
|
13
13
|
end
|
@@ -4,7 +4,7 @@ describe Esearch::Cluster, '#index' do
|
|
4
4
|
subject { object.index(name) }
|
5
5
|
|
6
6
|
let(:object) { described_class.new(connection) }
|
7
|
-
let(:connection) {
|
7
|
+
let(:connection) { double('Connection') }
|
8
8
|
let(:name) { 'foo' }
|
9
9
|
|
10
10
|
it { should eql(Esearch::Index.new(connection, name)) }
|
@@ -4,7 +4,7 @@ describe Esearch::Cluster, '#indices' do
|
|
4
4
|
subject { object.indices(names) }
|
5
5
|
|
6
6
|
let(:object) { described_class.new(connection) }
|
7
|
-
let(:connection) {
|
7
|
+
let(:connection) { double('Connection') }
|
8
8
|
let(:names) { %w(foo bar) }
|
9
9
|
|
10
10
|
it { should eql(Esearch::Indices.new(connection, names)) }
|
@@ -5,9 +5,9 @@ describe Esearch::Command, '.run' do
|
|
5
5
|
|
6
6
|
let(:object) { described_class }
|
7
7
|
|
8
|
-
let(:instance) {
|
9
|
-
let(:result) {
|
10
|
-
let(:arguments) { [:foo, :bar]
|
8
|
+
let(:instance) { double('Instance', :result => result) }
|
9
|
+
let(:result) { double('Result') }
|
10
|
+
let(:arguments) { [:foo, :bar] }
|
11
11
|
|
12
12
|
it 'should instantiate object and return result' do
|
13
13
|
described_class.should_receive(:new).with(*arguments).and_return(instance)
|
@@ -3,12 +3,12 @@ require 'spec_helper'
|
|
3
3
|
describe Esearch::Command::Cluster::Health, '.run' do
|
4
4
|
subject { object.run(context, options) }
|
5
5
|
|
6
|
-
let(:object) { described_class
|
7
|
-
let(:options) {
|
6
|
+
let(:object) { described_class }
|
7
|
+
let(:options) { double('Options') }
|
8
8
|
|
9
9
|
let(:expected_request) do
|
10
10
|
Esearch::Request.new(:get, '/_cluster/health', {}, options)
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
expect_presenter(Esearch::Presenter::Cluster::Health)
|
14
14
|
end
|
@@ -3,14 +3,14 @@ require 'spec_helper'
|
|
3
3
|
describe Esearch::Command::Document::Index::Create, '.run' do
|
4
4
|
subject { object.run(context, document, options) }
|
5
5
|
|
6
|
-
let(:object) { described_class
|
7
|
-
let(:document) {
|
8
|
-
let(:options) { { :foo => :bar }
|
6
|
+
let(:object) { described_class }
|
7
|
+
let(:document) { double('Document') }
|
8
|
+
let(:options) { { :foo => :bar } }
|
9
9
|
|
10
10
|
let(:expected_request) do
|
11
11
|
Esearch::Request.new(:post, '/foo', document, { :foo => :bar, :op_type => :create })
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
expect_presenter(Esearch::Presenter::Document::Operation::Index) do
|
15
15
|
let(:status) { 201 }
|
16
16
|
end
|
@@ -3,14 +3,14 @@ require 'spec_helper'
|
|
3
3
|
describe Esearch::Command::Document::Index::Create, '.run' do
|
4
4
|
subject { object.run(context, document, options) }
|
5
5
|
|
6
|
-
let(:object) { described_class
|
7
|
-
let(:document) {
|
8
|
-
let(:options) { { :foo => :bar }
|
6
|
+
let(:object) { described_class }
|
7
|
+
let(:document) { double('Document') }
|
8
|
+
let(:options) { { :foo => :bar } }
|
9
9
|
|
10
10
|
let(:expected_request) do
|
11
11
|
Esearch::Request.new(:post, '/foo', document, { :foo => :bar, :op_type => :create })
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
expect_presenter(Esearch::Presenter::Document::Operation::Index) do
|
15
15
|
let(:status) { 201 }
|
16
16
|
end
|
@@ -3,9 +3,9 @@ require 'spec_helper'
|
|
3
3
|
describe Esearch::Command::Document::Index, '.run' do
|
4
4
|
subject { object.run(context, document, options) }
|
5
5
|
|
6
|
-
let(:object) { described_class
|
7
|
-
let(:document) {
|
8
|
-
let(:options) { { :foo => :bar }
|
6
|
+
let(:object) { described_class }
|
7
|
+
let(:document) { double('Document') }
|
8
|
+
let(:options) { { :foo => :bar } }
|
9
9
|
|
10
10
|
let(:expected_request) do
|
11
11
|
Esearch::Request.new(:post, '/foo', document, options)
|
@@ -3,9 +3,9 @@ require 'spec_helper'
|
|
3
3
|
describe Esearch::Command::Document::Index::Update, '.run' do
|
4
4
|
subject { object.run(context, document, options) }
|
5
5
|
|
6
|
-
let(:object) { described_class
|
7
|
-
let(:document) {
|
8
|
-
let(:options) { { :foo => :bar }
|
6
|
+
let(:object) { described_class }
|
7
|
+
let(:document) { double('Document') }
|
8
|
+
let(:options) { { :foo => :bar } }
|
9
9
|
|
10
10
|
let(:expected_request) do
|
11
11
|
Esearch::Request.new(:post, '/foo', document, { :foo => :bar, :op_type => :index })
|
@@ -3,9 +3,9 @@ require 'spec_helper'
|
|
3
3
|
describe Esearch::Command::Document::Index::Update, '.run' do
|
4
4
|
subject { object.run(context, document, options) }
|
5
5
|
|
6
|
-
let(:object) { described_class
|
7
|
-
let(:document) {
|
8
|
-
let(:options) { { :foo => :bar }
|
6
|
+
let(:object) { described_class }
|
7
|
+
let(:document) { double('Document') }
|
8
|
+
let(:options) { { :foo => :bar } }
|
9
9
|
|
10
10
|
let(:expected_request) do
|
11
11
|
Esearch::Request.new(:post, '/foo', document, { :foo => :bar, :op_type => :index })
|
@@ -13,11 +13,11 @@ describe Esearch::Command::Exist, '.run' do
|
|
13
13
|
connection.should_receive(:run).with(expected_request).and_return(response)
|
14
14
|
end
|
15
15
|
|
16
|
-
let(:context) {
|
17
|
-
let(:connection) {
|
16
|
+
let(:context) { double('Context', :connection => connection, :path => Pathname.new('/foo')) }
|
17
|
+
let(:connection) { double('Connection') }
|
18
18
|
|
19
19
|
let(:headers) { {'content-type' => 'application/json; charset=UTF-8'} }
|
20
|
-
let(:response) {
|
20
|
+
let(:response) { double('Response', :frozen? => true, :status => status, :headers => headers, :body => '{}') }
|
21
21
|
|
22
22
|
context 'with status 200' do
|
23
23
|
let(:status) { 200 }
|
@@ -3,12 +3,12 @@ require 'spec_helper'
|
|
3
3
|
describe Esearch::Command::Index::Create, '.run' do
|
4
4
|
subject { object.run(context, settings) }
|
5
5
|
|
6
|
-
let(:object) { described_class
|
7
|
-
let(:settings) {
|
6
|
+
let(:object) { described_class }
|
7
|
+
let(:settings) { double('Settings') }
|
8
8
|
|
9
9
|
let(:expected_request) do
|
10
10
|
Esearch::Request.new(:put, '/foo', settings, {})
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
expect_presenter(Esearch::Presenter::Index::Create)
|
14
14
|
end
|
@@ -19,12 +19,12 @@ describe Esearch::Command, '#result' do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
|
22
|
-
let(:context) {
|
23
|
-
let(:connection) {
|
22
|
+
let(:context) { double('Context', :connection => connection, :path => Pathname.new('/foo')) }
|
23
|
+
let(:connection) { double('Connection') }
|
24
24
|
|
25
25
|
let(:headers) { {'content-type' => content_type } }
|
26
26
|
let(:content_type) { 'application/json; charset=UTF-8' }
|
27
|
-
let(:response) {
|
27
|
+
let(:response) { double('Response', :frozen? => true, :status => status, :headers => headers, :body => body) }
|
28
28
|
let(:body) { '{}' }
|
29
29
|
|
30
30
|
let(:status) { 200 }
|
@@ -4,7 +4,7 @@ describe Esearch::Command::Search, '.run' do
|
|
4
4
|
subject { object.run(context, query) }
|
5
5
|
|
6
6
|
let(:object) { described_class }
|
7
|
-
let(:query) {
|
7
|
+
let(:query) { double('Query') }
|
8
8
|
|
9
9
|
let(:expected_request) do
|
10
10
|
Esearch::Request.new(:get, '/foo/_search', query, {})
|
@@ -5,9 +5,9 @@ describe Esearch::Connection, '.build' do
|
|
5
5
|
|
6
6
|
subject { object.build(*arguments) }
|
7
7
|
|
8
|
-
let(:url) {
|
9
|
-
let(:logger) {
|
10
|
-
let(:connection) {
|
8
|
+
let(:url) { double('URL') }
|
9
|
+
let(:logger) { double('Logger') }
|
10
|
+
let(:connection) { double('Connection') }
|
11
11
|
|
12
12
|
before do
|
13
13
|
Faraday.should_receive(:new).with(url).and_return(connection)
|
@@ -5,10 +5,10 @@ describe Esearch::Connection, '#run' do
|
|
5
5
|
|
6
6
|
let(:object) { described_class.new(connection, logger) }
|
7
7
|
|
8
|
-
let(:connection) {
|
9
|
-
let(:logger) { DummyLogger.new
|
10
|
-
let(:request) {
|
11
|
-
let(:response) {
|
8
|
+
let(:connection) { double('Connection') }
|
9
|
+
let(:logger) { DummyLogger.new }
|
10
|
+
let(:request) { double('Request', :log_string => 'the-logged-string') }
|
11
|
+
let(:response) { double('Response', :status => 200) }
|
12
12
|
|
13
13
|
class DummyLogger
|
14
14
|
attr_reader :messages
|
@@ -16,8 +16,8 @@ describe Esearch::Connection, '#run' do
|
|
16
16
|
def initialize
|
17
17
|
@messages = []
|
18
18
|
end
|
19
|
-
|
20
|
-
def debug
|
19
|
+
|
20
|
+
def debug
|
21
21
|
@messages << yield
|
22
22
|
end
|
23
23
|
end
|
@@ -3,10 +3,10 @@ require 'spec_helper'
|
|
3
3
|
describe Esearch::Document, '#connection' do
|
4
4
|
subject { object.connection }
|
5
5
|
|
6
|
-
let(:object) { described_class.new(type, id)
|
7
|
-
let(:type) {
|
8
|
-
let(:connection) {
|
9
|
-
let(:id) { '1'
|
6
|
+
let(:object) { described_class.new(type, id) }
|
7
|
+
let(:type) { double('Type', :connection => connection) }
|
8
|
+
let(:connection) { double('Connection') }
|
9
|
+
let(:id) { '1' }
|
10
10
|
|
11
11
|
it { should be(connection) }
|
12
12
|
end
|
@@ -4,7 +4,7 @@ describe Esearch::Index, '#type' do
|
|
4
4
|
subject { object.type(name) }
|
5
5
|
|
6
6
|
let(:object) { described_class.new(connection, index_name) }
|
7
|
-
let(:connection) {
|
7
|
+
let(:connection) { double('Connection') }
|
8
8
|
let(:index_name) { 'foo' }
|
9
9
|
let(:name) { 'bar' }
|
10
10
|
|
@@ -3,8 +3,8 @@ require 'spec_helper'
|
|
3
3
|
describe Esearch::Indices::All, '#path' do
|
4
4
|
subject { object.path }
|
5
5
|
|
6
|
-
let(:object)
|
7
|
-
let(:connection) {
|
6
|
+
let(:object) { described_class.new(connection) }
|
7
|
+
let(:connection) { double('Connection') }
|
8
8
|
|
9
9
|
it { should eql(Pathname.new('/_all')) }
|
10
10
|
|
@@ -12,7 +12,7 @@ describe Esearch::Mixin::Document, '#index_create' do
|
|
12
12
|
|
13
13
|
context 'with one arg' do
|
14
14
|
subject { object.index_create(document) }
|
15
|
-
let(:document) {
|
15
|
+
let(:document) { double('Document') }
|
16
16
|
|
17
17
|
let(:expected_arguments) { [document, {}] }
|
18
18
|
|
@@ -21,8 +21,8 @@ describe Esearch::Mixin::Document, '#index_create' do
|
|
21
21
|
|
22
22
|
context 'with two args' do
|
23
23
|
subject { object.index_create(document, options) }
|
24
|
-
let(:document) {
|
25
|
-
let(:options) {
|
24
|
+
let(:document) { double('Document') }
|
25
|
+
let(:options) { double('Options') }
|
26
26
|
|
27
27
|
let(:expected_arguments) { [document, options] }
|
28
28
|
|
@@ -12,7 +12,7 @@ describe Esearch::Mixin::Document, '#index' do
|
|
12
12
|
|
13
13
|
context 'with one arg' do
|
14
14
|
subject { object.index(document) }
|
15
|
-
let(:document) {
|
15
|
+
let(:document) { double('Document') }
|
16
16
|
|
17
17
|
let(:expected_arguments) { [document, {}] }
|
18
18
|
|
@@ -21,8 +21,8 @@ describe Esearch::Mixin::Document, '#index' do
|
|
21
21
|
|
22
22
|
context 'with two args' do
|
23
23
|
subject { object.index(document, options) }
|
24
|
-
let(:document) {
|
25
|
-
let(:options) {
|
24
|
+
let(:document) { double('Document') }
|
25
|
+
let(:options) { double('Options') }
|
26
26
|
|
27
27
|
let(:expected_arguments) { [document, options] }
|
28
28
|
|
@@ -12,7 +12,7 @@ describe Esearch::Mixin::Document, '#index_update' do
|
|
12
12
|
|
13
13
|
context 'with one arg' do
|
14
14
|
subject { object.index_update(document) }
|
15
|
-
let(:document) {
|
15
|
+
let(:document) { double('Document') }
|
16
16
|
|
17
17
|
let(:expected_arguments) { [document, {}] }
|
18
18
|
|
@@ -21,8 +21,8 @@ describe Esearch::Mixin::Document, '#index_update' do
|
|
21
21
|
|
22
22
|
context 'with two args' do
|
23
23
|
subject { object.index_update(document, options) }
|
24
|
-
let(:document) {
|
25
|
-
let(:options) {
|
24
|
+
let(:document) { double('Document') }
|
25
|
+
let(:options) { double('Options') }
|
26
26
|
|
27
27
|
let(:expected_arguments) { [document, options] }
|
28
28
|
|
@@ -4,14 +4,14 @@ describe Esearch::Presenter::Aspect::Range, '#from' do
|
|
4
4
|
subject { object.from }
|
5
5
|
|
6
6
|
let(:object) { described_class.new(raw) }
|
7
|
-
let(:value)
|
7
|
+
let(:value) { double('Value') }
|
8
8
|
|
9
9
|
context 'when _source is present' do
|
10
10
|
let(:raw) { { 'from' => value } }
|
11
11
|
|
12
12
|
it { should be(value) }
|
13
13
|
|
14
|
-
it_should_behave_like 'an idempotent method'
|
14
|
+
it_should_behave_like 'an idempotent method'
|
15
15
|
end
|
16
16
|
|
17
17
|
context 'when _source is NOT present' do
|
@@ -19,6 +19,6 @@ describe Esearch::Presenter::Aspect::Range, '#from' do
|
|
19
19
|
|
20
20
|
it { should be(nil) }
|
21
21
|
|
22
|
-
it_should_behave_like 'an idempotent method'
|
22
|
+
it_should_behave_like 'an idempotent method'
|
23
23
|
end
|
24
24
|
end
|
@@ -4,14 +4,14 @@ describe Esearch::Presenter::Aspect::Range, '#to' do
|
|
4
4
|
subject { object.to }
|
5
5
|
|
6
6
|
let(:object) { described_class.new(raw) }
|
7
|
-
let(:value)
|
7
|
+
let(:value) { double('Value') }
|
8
8
|
|
9
9
|
context 'when _source is present' do
|
10
10
|
let(:raw) { { 'to' => value } }
|
11
11
|
|
12
12
|
it { should be(value) }
|
13
13
|
|
14
|
-
it_should_behave_like 'an idempotent method'
|
14
|
+
it_should_behave_like 'an idempotent method'
|
15
15
|
end
|
16
16
|
|
17
17
|
context 'when _source is NOT present' do
|
@@ -19,6 +19,6 @@ describe Esearch::Presenter::Aspect::Range, '#to' do
|
|
19
19
|
|
20
20
|
it { should be(nil) }
|
21
21
|
|
22
|
-
it_should_behave_like 'an idempotent method'
|
22
|
+
it_should_behave_like 'an idempotent method'
|
23
23
|
end
|
24
24
|
end
|
@@ -5,10 +5,10 @@ describe Esearch::Presenter, '.new' do
|
|
5
5
|
|
6
6
|
subject { object.new(raw) }
|
7
7
|
|
8
|
-
let(:value) {
|
8
|
+
let(:value) { double('Value') }
|
9
9
|
|
10
10
|
class DummyPresenter
|
11
|
-
include Concord.new(:raw)
|
11
|
+
include Concord.new(:raw)
|
12
12
|
end
|
13
13
|
|
14
14
|
context 'with exposed tagged collection' do
|
@@ -4,14 +4,14 @@ describe Esearch::Presenter::Hit, '#fields' do
|
|
4
4
|
subject { object.fields }
|
5
5
|
|
6
6
|
let(:object) { described_class.new(raw) }
|
7
|
-
let(:value)
|
7
|
+
let(:value) { double('Value') }
|
8
8
|
|
9
9
|
context 'when fields is present' do
|
10
10
|
let(:raw) { { 'fields' => value } }
|
11
11
|
|
12
12
|
it { should be(value) }
|
13
13
|
|
14
|
-
it_should_behave_like 'an idempotent method'
|
14
|
+
it_should_behave_like 'an idempotent method'
|
15
15
|
end
|
16
16
|
|
17
17
|
context 'when fields is NOT present' do
|
@@ -19,6 +19,6 @@ describe Esearch::Presenter::Hit, '#fields' do
|
|
19
19
|
|
20
20
|
it { should be(nil) }
|
21
21
|
|
22
|
-
it_should_behave_like 'an idempotent method'
|
22
|
+
it_should_behave_like 'an idempotent method'
|
23
23
|
end
|
24
24
|
end
|
@@ -4,14 +4,14 @@ describe Esearch::Presenter::Hit, '#source' do
|
|
4
4
|
subject { object.source }
|
5
5
|
|
6
6
|
let(:object) { described_class.new(raw) }
|
7
|
-
let(:value)
|
7
|
+
let(:value) { double('Value') }
|
8
8
|
|
9
9
|
context 'when _source is present' do
|
10
10
|
let(:raw) { { '_source' => value } }
|
11
11
|
|
12
12
|
it { should be(value) }
|
13
13
|
|
14
|
-
it_should_behave_like 'an idempotent method'
|
14
|
+
it_should_behave_like 'an idempotent method'
|
15
15
|
end
|
16
16
|
|
17
17
|
context 'when _source is NOT present' do
|
@@ -19,6 +19,6 @@ describe Esearch::Presenter::Hit, '#source' do
|
|
19
19
|
|
20
20
|
it { should be(nil) }
|
21
21
|
|
22
|
-
it_should_behave_like 'an idempotent method'
|
22
|
+
it_should_behave_like 'an idempotent method'
|
23
23
|
end
|
24
24
|
end
|
@@ -4,9 +4,9 @@ describe Esearch::Presenter::Hits, '#each' do
|
|
4
4
|
subject { object.each { |hit| yields << hit } }
|
5
5
|
|
6
6
|
let(:object) { described_class.new(raw) }
|
7
|
-
let(:yields) { []
|
8
|
-
let(:hit_a)
|
9
|
-
let(:hit_b)
|
7
|
+
let(:yields) { [] }
|
8
|
+
let(:hit_a) { double('Hit A') }
|
9
|
+
let(:hit_b) { double('Hit B') }
|
10
10
|
let(:raw) { { 'hits' => [ hit_a, hit_b ] } }
|
11
11
|
|
12
12
|
it_should_behave_like 'an #each method'
|
@@ -3,9 +3,9 @@ require 'spec_helper'
|
|
3
3
|
describe Esearch::Presenter::Hits, '#size' do
|
4
4
|
subject { object.size }
|
5
5
|
|
6
|
-
let(:object) { described_class.new(raw)
|
7
|
-
let(:size) {
|
8
|
-
let(:raw) { { 'hits' =>
|
6
|
+
let(:object) { described_class.new(raw) }
|
7
|
+
let(:size) { double('Size') }
|
8
|
+
let(:raw) { { 'hits' => double(:size => size)} }
|
9
9
|
|
10
10
|
it { should be(size) }
|
11
11
|
|
@@ -5,10 +5,10 @@ describe Esearch::Request, '.new' do
|
|
5
5
|
|
6
6
|
subject { object.new(*arguments) }
|
7
7
|
|
8
|
-
let(:verb) {
|
9
|
-
let(:path) { '/some/path'
|
10
|
-
let(:params) {
|
11
|
-
let(:body) {
|
8
|
+
let(:verb) { double('Verb') }
|
9
|
+
let(:path) { '/some/path' }
|
10
|
+
let(:params) { double('Params') }
|
11
|
+
let(:body) { double('Body') }
|
12
12
|
|
13
13
|
context 'with two args' do
|
14
14
|
let(:arguments) { [ verb, path ] }
|
@@ -10,9 +10,9 @@ describe Esearch::Request, '#run' do
|
|
10
10
|
let(:body) { { 'foo' => 'bar' } }
|
11
11
|
let(:params) { { 'baz' => 'buz' } }
|
12
12
|
|
13
|
-
let(:response_status) {
|
14
|
-
let(:response_headers) { {}
|
15
|
-
let(:response_body) {
|
13
|
+
let(:response_status) { double('Status') }
|
14
|
+
let(:response_headers) { {} }
|
15
|
+
let(:response_body) { double('Body') }
|
16
16
|
|
17
17
|
let(:connection) do
|
18
18
|
Faraday.new do |builder|
|
@@ -22,7 +22,7 @@ describe Esearch::Request, '#run' do
|
|
22
22
|
|
23
23
|
let(:stubs) do
|
24
24
|
Faraday::Adapter::Test::Stubs.new do |stub|
|
25
|
-
stub.get('/some/random/path') do |env|
|
25
|
+
stub.get('/some/random/path') do |env|
|
26
26
|
env.fetch(:request_headers).fetch('Content-Type').should eql('application/json; charset=UTF-8')
|
27
27
|
env.fetch(:method).should be(:get)
|
28
28
|
env.fetch(:params).should eql(params)
|
@@ -3,10 +3,10 @@ require 'spec_helper'
|
|
3
3
|
describe Esearch::Type, '#connection' do
|
4
4
|
subject { object.connection }
|
5
5
|
|
6
|
-
let(:object) { described_class.new(index, type_name)
|
7
|
-
let(:index) {
|
8
|
-
let(:connection) {
|
9
|
-
let(:type_name) {
|
6
|
+
let(:object) { described_class.new(index, type_name) }
|
7
|
+
let(:index) { double('Index', :connection => connection) }
|
8
|
+
let(:connection) { double('Connection') }
|
9
|
+
let(:type_name) { double('Type Name') }
|
10
10
|
|
11
11
|
it { should be(connection) }
|
12
12
|
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: esearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Markus Schirp
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-01-06 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: descendants_tracker
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: concord
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -46,7 +41,6 @@ dependencies:
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: faraday
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ~>
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ~>
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -62,23 +55,20 @@ dependencies:
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: adamantium
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
59
|
- - ~>
|
68
60
|
- !ruby/object:Gem::Version
|
69
|
-
version: 0.0
|
61
|
+
version: 0.1.0
|
70
62
|
type: :runtime
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
66
|
- - ~>
|
76
67
|
- !ruby/object:Gem::Version
|
77
|
-
version: 0.0
|
68
|
+
version: 0.1.0
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: equalizer
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
73
|
- - ~>
|
84
74
|
- !ruby/object:Gem::Version
|
@@ -86,7 +76,6 @@ dependencies:
|
|
86
76
|
type: :runtime
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
80
|
- - ~>
|
92
81
|
- !ruby/object:Gem::Version
|
@@ -94,7 +83,6 @@ dependencies:
|
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: abstract_type
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
87
|
- - ~>
|
100
88
|
- !ruby/object:Gem::Version
|
@@ -102,7 +90,6 @@ dependencies:
|
|
102
90
|
type: :runtime
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
94
|
- - ~>
|
108
95
|
- !ruby/object:Gem::Version
|
@@ -110,23 +97,20 @@ dependencies:
|
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
98
|
name: multi_json
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
101
|
- - ~>
|
116
102
|
- !ruby/object:Gem::Version
|
117
|
-
version: 1.
|
103
|
+
version: 1.8.2
|
118
104
|
type: :runtime
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
108
|
- - ~>
|
124
109
|
- !ruby/object:Gem::Version
|
125
|
-
version: 1.
|
110
|
+
version: 1.8.2
|
126
111
|
- !ruby/object:Gem::Dependency
|
127
112
|
name: null_logger
|
128
113
|
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
114
|
requirements:
|
131
115
|
- - ~>
|
132
116
|
- !ruby/object:Gem::Version
|
@@ -134,14 +118,13 @@ dependencies:
|
|
134
118
|
type: :runtime
|
135
119
|
prerelease: false
|
136
120
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
121
|
requirements:
|
139
122
|
- - ~>
|
140
123
|
- !ruby/object:Gem::Version
|
141
124
|
version: 0.0.1
|
142
125
|
description: Esearch driver for ruby
|
143
126
|
email:
|
144
|
-
- mbj@
|
127
|
+
- mbj@schirp-dso.com
|
145
128
|
executables: []
|
146
129
|
extensions: []
|
147
130
|
extra_rdoc_files:
|
@@ -158,6 +141,7 @@ files:
|
|
158
141
|
- README.md
|
159
142
|
- Rakefile
|
160
143
|
- TODO
|
144
|
+
- circle.yml
|
161
145
|
- config/devtools.yml
|
162
146
|
- config/flay.yml
|
163
147
|
- config/flog.yml
|
@@ -250,27 +234,26 @@ files:
|
|
250
234
|
homepage: https://github.com/mbj/elasticsearch
|
251
235
|
licenses:
|
252
236
|
- MIT
|
237
|
+
metadata: {}
|
253
238
|
post_install_message:
|
254
239
|
rdoc_options: []
|
255
240
|
require_paths:
|
256
241
|
- lib
|
257
242
|
required_ruby_version: !ruby/object:Gem::Requirement
|
258
|
-
none: false
|
259
243
|
requirements:
|
260
|
-
- -
|
244
|
+
- - '>='
|
261
245
|
- !ruby/object:Gem::Version
|
262
246
|
version: '0'
|
263
247
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
264
|
-
none: false
|
265
248
|
requirements:
|
266
|
-
- -
|
249
|
+
- - '>='
|
267
250
|
- !ruby/object:Gem::Version
|
268
251
|
version: '0'
|
269
252
|
requirements: []
|
270
253
|
rubyforge_project:
|
271
|
-
rubygems_version:
|
254
|
+
rubygems_version: 2.0.14
|
272
255
|
signing_key:
|
273
|
-
specification_version:
|
256
|
+
specification_version: 4
|
274
257
|
summary: Esearch driver for ruby
|
275
258
|
test_files:
|
276
259
|
- spec/integration/esearch/spike_spec.rb
|