Sha256: 8b00fce52b0e5fd6537c20d0aa6e846b9771ff89b4193b685a837b8a3caef929
Contents?: true
Size: 940 Bytes
Versions: 38
Compression:
Stored size: 940 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop module RSpec # Avoid opening modules and defining specs within them. # # @example # # bad # module MyModule # RSpec.describe MyClass do # # ... # end # end # # # good # RSpec.describe MyModule::MyClass do # # ... # end # # @see https://github.com/rubocop/rubocop-rspec/issues/735 class DescribedClassModuleWrapping < Base MSG = 'Avoid opening modules and defining specs within them.' # @!method include_rspec_blocks?(node) def_node_search :include_rspec_blocks?, <<~PATTERN ({block numblock} (send #explicit_rspec? #ExampleGroups.all ...) ...) PATTERN def on_module(node) return unless include_rspec_blocks?(node) add_offense(node) end end end end end
Version data entries
38 entries across 38 versions & 7 rubygems