lib/rubocop/cop/rspec/described_class.rb in rubocop-rspec-1.20.1 vs lib/rubocop/cop/rspec/described_class.rb in rubocop-rspec-1.21.0
- old
+ new
@@ -35,11 +35,11 @@
class DescribedClass < Cop
include RuboCop::RSpec::TopLevelDescribe
include ConfigurableEnforcedStyle
DESCRIBED_CLASS = 'described_class'.freeze
- MSG = 'Use `%s` instead of `%s`.'.freeze
+ MSG = 'Use `%<replacement>s` instead of `%<src>s`.'.freeze
def_node_matcher :common_instance_exec_closure?, <<-PATTERN
(block (send (const nil? {:Class :Module}) :new ...) ...)
PATTERN
@@ -89,12 +89,13 @@
end
end
def message(offense)
if style == :described_class
- format(MSG, DESCRIBED_CLASS, offense)
+ format(MSG, replacement: DESCRIBED_CLASS, src: offense)
else
- format(MSG, @described_class.const_name, DESCRIBED_CLASS)
+ format(MSG, replacement: @described_class.const_name,
+ src: DESCRIBED_CLASS)
end
end
def scope_change?(node)
scope_changing_syntax?(node) ||