lib/rubocop/cop/rspec/example_length.rb in rubocop-rspec-1.5.1 vs lib/rubocop/cop/rspec/example_length.rb in rubocop-rspec-1.5.2

- old
+ new

@@ -1,6 +1,5 @@ -# encoding: utf-8 # frozen_string_literal: true module RuboCop module Cop module RSpec @@ -33,26 +32,22 @@ _receiver, method_name, _object = *method return unless EXAMPLE_BLOCKS.include?(method_name) length = code_length(node) - return unless length > max - add_offense(node, :expression, message(length, max)) + return unless length > max_length + add_offense(node, :expression, message(length)) end private - def max - cop_config['Max'] - end - def code_length(node) - lines = node.source.lines.to_a[1..-2] || [] + lines = node.source.lines[1..-2] lines.count { |line| !irrelevant_line(line) } end - def message(length, max_length) + def message(length) format('Example has too many lines. [%d/%d]', length, max_length) end end end end