Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3fc6101

Browse files
elasticsearch-rails: remove type, whitespace cleanup
1 parent e456789 commit 3fc6101

File tree

3 files changed

+27
-21
lines changed

3 files changed

+27
-21
lines changed

‎elasticsearch-rails/lib/rails/templates/indexer.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def perform(operation, klass, record_id, options={})
3737
record.__elasticsearch__.client = Client
3838
record.__elasticsearch__.__send__ "#{operation}_document"
3939
when /delete/
40-
Client.delete index: klass.constantize.index_name, type: klass.constantize.document_type,id: record_id
40+
Client.delete index: klass.constantize.index_name, id: record_id
4141
else raise ArgumentError, "Unknown operation '#{operation}'"
4242
end
4343
end

‎elasticsearch-rails/spec/instrumentation_spec.rb‎

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,10 @@
1818
require 'spec_helper'
1919

2020
describe 'ActiveSupport::Instrumentation integration' do
21-
2221
before(:all) do
2322
class DummyInstrumentationModel
2423
extend Elasticsearch::Model::Searching::ClassMethods
25-
26-
def self.index_name; 'foo'; end
27-
def self.document_type; 'bar'; end
24+
def self.index_name; 'foo'; end
2825
end
2926
end
3027

@@ -33,10 +30,14 @@ def self.document_type; 'bar'; end
3330
end
3431

3532
let(:response_document) do
36-
{ 'took' => '5ms',
37-
'hits' => { 'total' => 123,
38-
'max_score' => 456,
39-
'hits' => [] } }
33+
{
34+
'took' => '5ms',
35+
'hits' => {
36+
'total' => 123,
37+
'max_score' => 456,
38+
'hits' => []
39+
}
40+
}
4041
end
4142

4243
let(:search) do
@@ -53,22 +54,26 @@ def self.document_type; 'bar'; end
5354
end
5455

5556
context 'SearchRequest#execute!' do
56-
5757
it 'wraps the method with instrumentation' do
5858
expect(search).to respond_to(:execute_without_instrumentation!)
5959
expect(search).to respond_to(:execute_with_instrumentation!)
6060
end
6161
end
6262

6363
context 'Model#search' do
64-
6564
before do
66-
expect(ActiveSupport::Notifications).to receive(:instrument).with('search.elasticsearch',
67-
{ klass: 'DummyInstrumentationModel',
68-
name: 'Search',
69-
search: { body: query,
70-
index: 'foo',
71-
type: 'bar' } }).and_return({})
65+
expect(ActiveSupport::Notifications).
66+
to receive(:instrument).
67+
with('search.elasticsearch',
68+
{
69+
klass: 'DummyInstrumentationModel',
70+
name: 'Search',
71+
search: {
72+
body: query,
73+
index: 'foo',
74+
}
75+
}
76+
).and_return({})
7277
end
7378

7479
let(:query) do

‎elasticsearch-rails/spec/lograge_spec.rb‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,15 @@
3838
require 'elasticsearch/rails/lograge'
3939

4040
describe 'ActiveSupport::Instrumentation integration' do
41-
4241
before do
4342
Elasticsearch::Rails::Lograge::Railtie.run_initializers
4443
end
4544

4645
it 'customizes the Lograge configuration' do
47-
expect(Elasticsearch::Rails::Lograge::Railtie.initializers
48-
.select { |i| i.name == 'elasticsearch.lograge' }
49-
.first).not_to be_nil
46+
expect(
47+
Elasticsearch::Rails::Lograge::Railtie.initializers
48+
.select { |i| i.name == 'elasticsearch.lograge' }
49+
.first
50+
).not_to be_nil
5051
end
5152
end

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /