Skip to content

Commit 1591154

Browse files
committed
Code Style changes
1 parent 36a0027 commit 1591154

File tree

5 files changed

+19
-17
lines changed

5 files changed

+19
-17
lines changed

elasticsearch-model/Rakefile

+2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ namespace :test do
5656
puts '-' * 80
5757
end
5858
end
59+
60+
task unit: :all
5961
end
6062

6163
# ----- Documentation tasks ---------------------------------------------------

elasticsearch-model/spec/elasticsearch/model/importing_spec.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class DummyImportingModel
2424

2525
module DummyImportingAdapter
2626
module ImportingMixin
27-
def __find_in_batches( options = {}, &block)
27+
def __find_in_batches(options = {}, &block)
2828
yield if block_given?
2929
end
3030
def __transform
@@ -125,7 +125,7 @@ def importing_mixin
125125
context 'when the method is called with the force option' do
126126
before do
127127
expect(DummyImportingModel).to receive(:create_index!).with(force: true, index: 'foo').and_return(true)
128-
expect(DummyImportingModel).to receive(:__find_in_batches).with(foo: 'bar').and_return(true)
128+
expect(DummyImportingModel).to receive(:__find_in_batches).with({ foo: 'bar' }).and_return(true)
129129
end
130130

131131
it 'deletes and creates the index' do
@@ -136,7 +136,7 @@ def importing_mixin
136136
context 'when the method is called with the refresh option' do
137137
before do
138138
expect(DummyImportingModel).to receive(:refresh_index!).with(index: 'foo').and_return(true)
139-
expect(DummyImportingModel).to receive(:__find_in_batches).with(foo: 'bar').and_return(true)
139+
expect(DummyImportingModel).to receive(:__find_in_batches).with({ foo: 'bar' }).and_return(true)
140140
end
141141

142142
it 'refreshes the index' do
@@ -147,7 +147,7 @@ def importing_mixin
147147
context 'when a different index name is provided' do
148148
before do
149149
expect(DummyImportingModel).to receive(:client).and_return(client)
150-
expect(client).to receive(:bulk).with(body: nil, index: 'my-new-index').and_return(response)
150+
expect(client).to receive(:bulk).with({ body: nil, index: 'my-new-index' }).and_return(response)
151151
end
152152

153153
it 'uses the alternate index name' do
@@ -203,7 +203,7 @@ def importing_mixin
203203
context 'when a pipeline is provided as an options' do
204204
before do
205205
expect(DummyImportingModel).to receive(:client).and_return(client)
206-
expect(client).to receive(:bulk).with(body: nil, index: 'foo', pipeline: 'my-pipeline').and_return(response)
206+
expect(client).to receive(:bulk).with({ body: nil, index: 'foo', pipeline: 'my-pipeline' }).and_return(response)
207207
end
208208

209209
it 'uses the pipeline option' do

elasticsearch-model/spec/elasticsearch/model/proxy_spec.rb

+3-4
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,9 @@ def changes_to_save
122122
expect(model).to eq(model_target)
123123
expect(duplicate).to eq(duplicate_target)
124124
end
125-
end
126125

127-
it 'forwards keyword arguments to target methods' do
128-
expect(DummyProxyModel.new.__elasticsearch__.keyword_method(foo: 'bar')).to eq('bar')
126+
it 'forwards keyword arguments to target methods' do
127+
expect(DummyProxyModel.new.__elasticsearch__.keyword_method(foo: 'bar')).to eq('bar')
128+
end
129129
end
130-
131130
end

elasticsearch-model/spec/elasticsearch/model/response/aggregations_spec.rb

+4-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ def self.index_name; 'foo'; end
3333
{
3434
'aggregations' => {
3535
'foo' => {'bar' => 10 },
36-
'price' => { 'doc_count' => 123,
37-
'min' => { 'value' => 1.0},
38-
'max' => { 'value' => 99 }
36+
'price' => {
37+
'doc_count' => 123,
38+
'min' => { 'value' => 1.0},
39+
'max' => { 'value' => 99 }
3940
}
4041
}
4142
}

elasticsearch-model/spec/elasticsearch/model/searching_search_request_spec.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def self.index_name; 'foo'; end
4343
context 'when the search definition is a simple query' do
4444

4545
before do
46-
expect(client).to receive(:search).with(index: 'foo', q: 'foo').and_return({})
46+
expect(client).to receive(:search).with({ index: 'foo', q: 'foo' }).and_return({})
4747
end
4848

4949
let(:search) do
@@ -58,7 +58,7 @@ def self.index_name; 'foo'; end
5858
context 'when the search definition is a hash' do
5959

6060
before do
61-
expect(client).to receive(:search).with(index: 'foo', body: { foo: 'bar' }).and_return({})
61+
expect(client).to receive(:search).with({ index: 'foo', body: { foo: 'bar' } }).and_return({})
6262
end
6363

6464
let(:search) do
@@ -73,7 +73,7 @@ def self.index_name; 'foo'; end
7373
context 'when the search definition is a json string' do
7474

7575
before do
76-
expect(client).to receive(:search).with(index: 'foo', body: '{"foo":"bar"}').and_return({})
76+
expect(client).to receive(:search).with({ index: 'foo', body: '{"foo":"bar"}' }).and_return({})
7777
end
7878

7979
let(:search) do
@@ -98,7 +98,7 @@ def to_hash; {foo: 'bar'}; end
9898
end
9999

100100
before do
101-
expect(client).to receive(:search).with(index: 'foo', body: {foo: 'bar'}).and_return({})
101+
expect(client).to receive(:search).with({ index: 'foo', body: {foo: 'bar'} }).and_return({})
102102
end
103103

104104
let(:search) do
@@ -113,7 +113,7 @@ def to_hash; {foo: 'bar'}; end
113113
context 'when extra options are specified' do
114114

115115
before do
116-
expect(client).to receive(:search).with(index: 'foo', q: 'foo', size: 15).and_return({})
116+
expect(client).to receive(:search).with({ index: 'foo', q: 'foo', size: 15 }).and_return({})
117117
end
118118

119119
let(:search) do

0 commit comments

Comments
 (0)