Skip to content

Commit

Permalink
Fix rubocop warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Envek committed Aug 3, 2023
1 parent 2f4fc1b commit 61a0633
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ require:
- rubocop-rspec

AllCops:
TargetRubyVersion: 2.4
TargetRubyVersion: 2.5

Metrics/BlockLength:
Exclude:
Expand Down
1 change: 1 addition & 0 deletions lib/yabeda/rails/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

module Yabeda
module Rails
# yabeda-rails configuration
class Config < ::Anyway::Config
config_name :yabeda_rails

Expand Down
1 change: 1 addition & 0 deletions lib/yabeda/rails/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module Yabeda
module Rails
# ActiveSupport Event with added logic for Yabeda tags formatting
class Event < ActiveSupport::Notifications::Event
def labels
@labels ||= begin
Expand Down
25 changes: 15 additions & 10 deletions spec/yabeda/rails_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,20 @@ def app
.with_tags(controller: "hello", action: "internal_server_error", status: 500, method: "get", format: :html)
end

it "supports configuring controller name case" do
original_case = described_class.config.controller_name_case
described_class.config.controller_name_case = :camel

expect { get "/hello/world" }.to \
increment_yabeda_counter(Yabeda.rails.requests_total)
.with_tags(controller: "HelloController", action: "world", status: 200, method: "get", format: :html)
.by(1)

described_class.config.controller_name_case = original_case
context "with changed controller name case config tp camel case" do
around do |example|
original_case = described_class.config.controller_name_case
described_class.config.controller_name_case = :camel
example.call
ensure
described_class.config.controller_name_case = original_case
end

it "reports controller tag in camel case" do
expect { get "/hello/world" }.to \
increment_yabeda_counter(Yabeda.rails.requests_total)
.with_tags(controller: "HelloController", action: "world", status: 200, method: "get", format: :html)
.by(1)
end
end
end
2 changes: 1 addition & 1 deletion yabeda-rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.required_ruby_version = ">= 2.4"
spec.required_ruby_version = ">= 2.5"

spec.add_dependency "activesupport"
spec.add_dependency "anyway_config", ">= 1.3", "< 3"
Expand Down

0 comments on commit 61a0633

Please sign in to comment.