Class: FactoryBot::Linter

Inherits:
Object
  • Object
show all
Defined in:
lib/factory_bot/linter.rb

Defined Under Namespace

Classes: FactoryError, FactoryTraitError

Instance Method Summary collapse

Constructor Details

#initialize(factories, strategy: :create, traits: false, verbose: false) ⇒ Linter

Returns a new instance of Linter.



3
4
5
6
7
8
9
# File 'lib/factory_bot/linter.rb', line 3

def initialize(factories, strategy: :create, traits: false, verbose: false)
  @factories_to_lint = factories
  @factory_strategy = strategy
  @traits = traits
  @verbose = verbose
  @invalid_factories = calculate_invalid_factories
end

Instance Method Details

#lint!Object



11
12
13
14
15
# File 'lib/factory_bot/linter.rb', line 11

def lint!
  if invalid_factories.any?
    raise InvalidFactoryError, error_message
  end
end