Class: FactoryBot::Linter::FactoryError

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

Direct Known Subclasses

FactoryTraitError

Instance Method Summary collapse

Constructor Details

#initialize(wrapped_error, factory) ⇒ FactoryError

Returns a new instance of FactoryError.



30
31
32
33
# File 'lib/factory_bot/linter.rb', line 30

def initialize(wrapped_error, factory)
  @wrapped_error = wrapped_error
  @factory       = factory
end

Instance Method Details

#locationObject



47
48
49
# File 'lib/factory_bot/linter.rb', line 47

def location
  @factory.name
end

#messageObject



35
36
37
38
# File 'lib/factory_bot/linter.rb', line 35

def message
  message = @wrapped_error.message
  "* #{location} - #{message} (#{@wrapped_error.class.name})"
end

#verbose_messageObject



40
41
42
43
44
45
# File 'lib/factory_bot/linter.rb', line 40

def verbose_message
  <<~MESSAGE
    #{message}
      #{@wrapped_error.backtrace.join("\n  ")}
  MESSAGE
end