Class: RuboCop::Cop::Kanso::NoRailsHelperRequire

Inherits:
Base
  • Object
show all
Extended by:
AutoCorrector
Includes:
RangeHelp
Defined in:
lib/rubocop/cop/kanso/no_rails_helper_require.rb

Constant Summary collapse

MSG =
'Do not require "rails_helper" in spec files. ' \
'Configure .rspec file with `--require spec_helper` and `--require rails_helper` instead.'.freeze
RESTRICT_ON_SEND =
[:require].freeze

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/rubocop/cop/kanso/no_rails_helper_require.rb', line 21

def on_send(node)
  return unless rails_helper_require?(node)

  add_offense(node) do |corrector|
    corrector.remove(removal_range(node))
  end
end

#rails_helper?(str) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/rubocop/cop/kanso/no_rails_helper_require.rb', line 17

def rails_helper?(str)
  str == 'rails_helper'
end