lib/rubocop/cop/rspec/let_before_examples.rb in rubocop-rspec-1.18.0 vs lib/rubocop/cop/rspec/let_before_examples.rb in rubocop-rspec-1.19.0
- old
+ new
@@ -31,11 +31,11 @@
# expect(some).to be
# end
class LetBeforeExamples < Cop
MSG = 'Move `let` before the examples in the group.'.freeze
- def_node_matcher :let?, '(block (send nil {:let :let!} ...) ...)'
+ def_node_matcher :let?, '(block (send nil? {:let :let!} ...) ...)'
def_node_matcher :example_or_group?, <<-PATTERN
{
#{(Examples::ALL + ExampleGroups::ALL).block_pattern}
#{Includes::EXAMPLES.send_pattern}
}
@@ -56,10 +56,10 @@
def check_let_declarations(node)
example_found = false
node.each_child_node do |child|
if let?(child)
- add_offense(child, :expression) if example_found
+ add_offense(child, location: :expression) if example_found
elsif example_or_group?(child)
example_found = true
end
end
end