lib/rubocop/cop/rspec/example_wording.rb in rubocop-rspec-1.3.1 vs lib/rubocop/cop/rspec/example_wording.rb in rubocop-rspec-1.4.0

- old
+ new

@@ -1,6 +1,7 @@ # encoding: utf-8 +# frozen_string_literal: true module RuboCop module Cop module RSpec # Do not use should when describing your tests. @@ -16,24 +17,25 @@ # # # good # it 'finds nothing' do # end class ExampleWording < Cop - MSG = 'Do not use should when describing your tests.' + MSG = 'Do not use should when describing your tests.'.freeze - def on_block(node) # rubocop:disable Metrics/AbcSize + def on_block(node) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/LineLength method, = *node _, method_name, *args = *method return unless method_name == :it - arguments = *(args.first) + arguments = *args.first message = arguments.first.to_s return unless message.downcase.start_with?('should') arg1 = args.first.loc.expression - message = Parser::Source::Range - .new(arg1.source_buffer, arg1.begin_pos + 1, arg1.end_pos - 1) + message = Parser::Source::Range.new(arg1.source_buffer, + arg1.begin_pos + 1, + arg1.end_pos - 1) add_offense(message, message, MSG) end def autocorrect(range)