Sha256: f8c848d4705a443988e6a73d10ce3db7464e0faaff4a54275a0100ea07b726ea
Contents?: true
Size: 887 Bytes
Versions: 2
Compression:
Stored size: 887 Bytes
Contents
# encoding: utf-8 module Rubocop module Cop # Checks for multiple top level describes. They should be nested if it is # for the same class or module or seperated into different files. # # @example # # bad # describe MyClass, '.do_someting' do # end # describe MyClass, '.do_someting_else' do # end # # #good # describe MyClass # describe '.do_someting' do # end # describe '.do_someting_else' do # end # end class RSpecMultipleDescribes < Cop include RSpec::TopLevelDescribe MESSAGE = 'Do not use multiple top level describes - try to nest them.' def on_top_level_describe(node, _args) return if single_top_level_describe? return unless top_level_nodes.first == node add_offense(node, :expression, MESSAGE) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubocop-rspec-1.0.rc2 | lib/rubocop/cop/rspec_multiple_describes.rb |
rubocop-rspec-1.0.rc1 | lib/rubocop/cop/rspec_multiple_describes.rb |