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.



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

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

Instance Method Details

#locationObject



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

def location
  @factory.name
end

#messageObject



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

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

#verbose_messageObject



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

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