Class: RuboCop::Cop::RSpec::FactoryBot::SyntaxMethods
- Extended by:
- AutoCorrector
- Includes:
- RangeHelp, InsideExampleGroup, RSpec::FactoryBot::Language
- Defined in:
- lib/rubocop/cop/rspec/factory_bot/syntax_methods.rb
Overview
Use shorthands from ‘FactoryBot::Syntax::Methods` in your specs.
Constant Summary collapse
- MSG =
'Use `%<method>s` from `FactoryBot::Syntax::Methods`.'
- RESTRICT_ON_SEND =
RuboCop::RSpec::FactoryBot::Language::METHODS
Constants included from RSpec::FactoryBot::Language
RSpec::FactoryBot::Language::METHODS
Instance Method Summary collapse
Methods included from RSpec::FactoryBot::Language
Methods inherited from Base
inherited, #on_new_investigation
Methods included from RSpec::Language::NodePattern
#block_pattern, #numblock_pattern, #send_pattern
Methods included from RSpec::Language
#example?, #example_group?, #example_group_with_body?, #hook?, #include?, #let?, #rspec?, #shared_group?, #spec_group?, #subject?
Instance Method Details
#on_send(node) ⇒ Object
59 60 61 62 63 64 65 66 67 68 |
# File 'lib/rubocop/cop/rspec/factory_bot/syntax_methods.rb', line 59 def on_send(node) return unless factory_bot?(node.receiver) return unless inside_example_group?(node) = format(MSG, method: node.method_name) add_offense(crime_scene(node), message: ) do |corrector| corrector.remove(offense(node)) end end |