Skip to content

Commit

Permalink
style(Style/OpenStructUse): manual
Browse files Browse the repository at this point in the history
  • Loading branch information
antonsavitskiy committed Apr 26, 2023
1 parent 511572c commit 1ce6a97
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ Style/ClassVars:
- 'spec/mongoid/clients/transactions_spec_models.rb'
- 'spec/mongoid/contextual/mongo/documents_loader_spec.rb'

Style/OpenStructUse:
Exclude:
- 'lib/mongoid/indexable.rb'

Style/CaseEquality:
Exclude:
- 'lib/mongoid/association/embedded/embeds_many/proxy.rb'
Expand Down
7 changes: 0 additions & 7 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -828,13 +828,6 @@ Style/MultilineBlockChain:
- 'spec/mongoid/changeable_spec.rb'
- 'spec/mongoid/document_spec.rb'

# Offense count: 4
Style/OpenStructUse:
Exclude:
- 'lib/mongoid/indexable.rb'
- 'spec/rails/controller_extension/controller_runtime_spec.rb'
- 'spec/support/rails_mock.rb'

# Offense count: 17
# Configuration parameters: AllowedMethods.
# AllowedMethods: respond_to_missing?
Expand Down
6 changes: 5 additions & 1 deletion spec/rails/controller_extension/controller_runtime_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ def clear_metric!

describe 'Collector' do

before do
stub_const('EventPayload', Struct.new(:duration))
end

it 'stores the metric in thread-safe manner' do
clear_metric!
expect(collector.runtime).to eq(0)
Expand All @@ -50,7 +54,7 @@ def clear_metric!

it 'sets metric on both succeeded and failed' do
instance = collector.new
event_payload = OpenStruct.new duration: 42
event_payload = EventPayload.new(42)

clear_metric!
instance.succeeded event_payload
Expand Down
8 changes: 6 additions & 2 deletions spec/support/rails_mock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@ def eager_load!; end
end
end

ConfigPaths = Struct.new(:expanded)

AppConfig = Struct.new(:paths)

Rails.env = 'development'
Rails.root = Pathname.new('.')
Rails.logger = Logger.new($stdout)
Rails.application = Rails::Application

Rails.application.config = OpenStruct.new(
paths: { 'app/models' => OpenStruct.new(expanded: ['app/models']) }
Rails.application.config = AppConfig.new(
paths: { 'app/models' => ConfigPaths.new(['app/models']) }
)

0 comments on commit 1ce6a97

Please sign in to comment.