lib/rubocop/cop/rspec/file_path.rb in rubocop-rspec-1.20.1 vs lib/rubocop/cop/rspec/file_path.rb in rubocop-rspec-1.21.0
- old
+ new
@@ -42,11 +42,11 @@
# my_class_spec.rb # describe MyClass, '#method'
#
class FilePath < Cop
include RuboCop::RSpec::TopLevelDescribe
- MSG = 'Spec path should end with `%s`.'.freeze
+ MSG = 'Spec path should end with `%<suffix>s`.'.freeze
def_node_search :const_described?, '(send _ :describe (const ...) ...)'
def_node_search :routing_metadata?, '(pair (sym :type) (sym :routing))'
def on_top_level_describe(node, args)
@@ -55,10 +55,14 @@
glob = glob_for(args)
return if filename_ends_with?(glob)
- add_offense(node, location: :expression, message: format(MSG, glob))
+ add_offense(
+ node,
+ location: :expression,
+ message: format(MSG, suffix: glob)
+ )
end
private
def routing_spec?(args)