diff options
Diffstat (limited to 'spec/rubocop/formatter/todo_formatter_spec.rb')
-rw-r--r-- | spec/rubocop/formatter/todo_formatter_spec.rb | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/spec/rubocop/formatter/todo_formatter_spec.rb b/spec/rubocop/formatter/todo_formatter_spec.rb index fcff028f07d..df56ee45931 100644 --- a/spec/rubocop/formatter/todo_formatter_spec.rb +++ b/spec/rubocop/formatter/todo_formatter_spec.rb @@ -261,16 +261,12 @@ RSpec.describe RuboCop::Formatter::TodoFormatter do double(:offense, cop_name: cop_name) end - def stub_rubocop_registry(**cops) - rubocop_registry = double(:rubocop_registry) - - allow(RuboCop::Cop::Registry).to receive(:global).and_return(rubocop_registry) - - allow(rubocop_registry).to receive(:find_by_cop_name) - .with(String).and_return(nil) + def stub_rubocop_registry(cops) + allow(RuboCop::CopTodo).to receive(:find_cop_by_name) + .with(String).and_return(nil).and_call_original cops.each do |cop_name, attributes| - allow(rubocop_registry).to receive(:find_by_cop_name) + allow(RuboCop::CopTodo).to receive(:find_cop_by_name) .with(cop_name).and_return(fake_cop(**attributes)) end end |