lib/rubocop/cop/rspec/file_path.rb in rubocop-rspec-1.32.0 vs lib/rubocop/cop/rspec/file_path.rb in rubocop-rspec-1.33.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 `%<suffix>s`.'.freeze
+ MSG = 'Spec path should end with `%<suffix>s`.'
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)
@@ -73,10 +73,10 @@
def glob_for((described_class, method_name))
"#{expected_path(described_class)}#{name_glob(method_name)}*_spec.rb"
end
def name_glob(name)
- return unless name && name.str_type?
+ return unless name&.str_type?
"*#{name.str_content.gsub(/\W/, '')}" unless ignore_methods?
end
def expected_path(constant)