lib/rubocop/cop/rspec/file_path.rb in rubocop-rspec-1.6.0 vs lib/rubocop/cop/rspec/file_path.rb in rubocop-rspec-1.7.0
- old
+ new
@@ -1,10 +1,12 @@
# frozen_string_literal: true
module RuboCop
module Cop
module RSpec
+ # Checks that spec file paths are consistent with the test subject.
+ #
# Checks the path of the spec file and enforces that it reflects the
# described class/module and its optionally called out method.
#
# With the configuration option `CustomTransform` modules or classes can
# be specified that should not as usual be transformed from CamelCase to
@@ -13,10 +15,10 @@
# @example
# my_class/method_spec.rb # describe MyClass, '#method'
# my_class_method_spec.rb # describe MyClass, '#method'
# my_class_spec.rb # describe MyClass
class FilePath < Cop
- include RuboCop::RSpec::TopLevelDescribe
+ include RuboCop::RSpec::SpecOnly, RuboCop::RSpec::TopLevelDescribe
MESSAGE = 'Spec path should end with `%s`'.freeze
METHOD_STRING_MATCHER = /^[\#\.].+/
ROUTING_PAIR = s(:pair, s(:sym, :type), s(:sym, :routing))