Class: FactoryGirl::Linter

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

Defined Under Namespace

Classes: FactoryError, FactoryTraitError

Instance Method Summary collapse

Constructor Details

#initialize(factories, linting_strategy, factory_strategy = :create) ⇒ Linter

Returns a new instance of Linter.



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

def initialize(factories, linting_strategy, factory_strategy = :create)
  @factories_to_lint = factories
  @linting_method = "lint_#{linting_strategy}"
  @factory_strategy = factory_strategy
  @invalid_factories = calculate_invalid_factories
end

Instance Method Details

#lint!Object



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

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