Movatterモバイル変換


[0]ホーム

URL:


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

Commit797696a

Browse files
committed
Updates logsubscriber color code AR 7.0
1 parent3c8035d commit797696a

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

‎elasticsearch-rails/lib/elasticsearch/rails/instrumentation/log_subscriber.rb‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
moduleElasticsearch
1919
moduleRails
2020
moduleInstrumentation
21-
2221
# A log subscriber to attach to Elasticsearch related events
2322
#
2423
# @see https://github.com/rails/rails/blob/master/activerecord/lib/active_record/log_subscriber.rb
@@ -58,10 +57,9 @@ def color_option(bold_value)
5857
defnew_color_syntax?
5958
return@new_color_syntaxifdefined?(@new_color_syntax)
6059

61-
@new_color_syntax= ::Rails.respond_to?(:gem_version) && ::Rails.gem_version >='7.1'
60+
@new_color_syntax= ::ActiveSupport.respond_to?(:gem_version) && ::ActiveSupport::gem_version >='7.1'
6261
end
6362
end
64-
6563
end
6664
end
6765
end

‎elasticsearch-rails/spec/instrumentation/log_subscriber_spec.rb‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,27 @@
2727
allow(instance).toreceive(:logger){logger}
2828
end
2929

30-
describe"#search"do
30+
describe'#search'do
3131
subject{instance.search(event)}
3232

3333
let(:event){double("search.elasticsearch",duration:1.2345,payload:{name:"execute",search:{query:{match_all:{}}}})}
3434

35-
it"logs the event"do
35+
it'logs the event'do
3636
expect(instance).toreceive(:color).with(" execute (1.2ms)",described_class::GREEN,{bold:true}).and_call_original
3737
expect(logger).toreceive(:debug?){true}
3838
expect(logger).toreceive(:debug).with("\e[1m\e[32m execute (1.2ms)\e[0m\e[2m{query: {match_all: {}}}\e[0m")
3939
subject
4040
end
4141

42-
context"whenRails version is older"do
43-
let(:rails_version){"7.0.0"}
42+
context'whenActiveSupport version is older'do
43+
let(:active_support_version){'7.0.0'}
4444

4545
beforedo
46-
allow(::Rails).toreceive(:gem_version){Gem::Version.new(rails_version)}
46+
allow(::ActiveSupport).toreceive(:gem_version){Gem::Version.new(active_support_version)}
4747
end
4848

49-
it"logs the event"do
50-
expect(instance).toreceive(:color).with(" execute (1.2ms)",described_class::GREEN,true).and_call_original
49+
it'logs the event'do
50+
expect(instance).toreceive(:color).with(' execute (1.2ms)',described_class::GREEN,true).and_return"\e[1m\e[32m execute (1.2ms)\e[0m"
5151
expect(logger).toreceive(:debug?){true}
5252
expect(logger).toreceive(:debug).with("\e[1m\e[32m execute (1.2ms)\e[0m\e[2m{query: {match_all: {}}}\e[0m")
5353
subject

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp