lib/rubocop/cop/rspec/described_class.rb in rubocop-rspec-1.18.0 vs lib/rubocop/cop/rspec/described_class.rb in rubocop-rspec-1.19.0

- old
+ new

@@ -38,11 +38,11 @@ DESCRIBED_CLASS = 'described_class'.freeze MSG = 'Use `%s` instead of `%s`.'.freeze def_node_matcher :common_instance_exec_closure?, <<-PATTERN - (block (send (const nil {:Class :Module}) :new ...) ...) + (block (send (const nil? {:Class :Module}) :new ...) ...) PATTERN def_node_matcher :rspec_block?, RuboCop::RSpec::Language::ALL.block_pattern @@ -55,10 +55,14 @@ # in case we explicit style is used, this cop needs to remember what's # being described, so to replace described_class with the constant @described_class = described_class find_usage(body) do |match| - add_offense(match, :expression, message(match.const_name)) + add_offense( + match, + location: :expression, + message: message(match.const_name) + ) end end def autocorrect(node) replacement = if style == :described_class