Class: RuboCop::Cop::Betterment::NotUsingRswag

Inherits:
Base
  • Object
show all
Defined in:
lib/rubocop/cop/betterment/not_using_rswag.rb

Constant Summary collapse

MSG =
'Request specs must use rswag to test and document their API endpoints. See: https://github.com/rswag/rswag'

Instance Method Summary collapse

Instance Method Details

#on_block(node) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/rubocop/cop/betterment/not_using_rswag.rb', line 9

def on_block(node)
  # Only run from root Rspec.describe block
  return unless rspec_describe?(node)

  # If the block descendants contain rswag structure, it's valid
  return if contains_rswag_structure?(node)

  # Otherwise, add offense
  add_offense(node)
end