Class: SpecForge::Error::InvalidFakerMethodError
- Inherits:
-
Error
- Object
- Error
- SpecForge::Error::InvalidFakerMethodError
- Defined in:
- lib/spec_forge/error.rb
Overview
Raised when a provided method for a Faker class doesn't exist Provides helpful suggestions for similar method names
Instance Method Summary collapse
-
#initialize(input, klass) ⇒ InvalidFakerMethodError
constructor
A new instance of InvalidFakerMethodError.
Constructor Details
#initialize(input, klass) ⇒ InvalidFakerMethodError
Returns a new instance of InvalidFakerMethodError.
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/spec_forge/error.rb', line 48 def initialize(input, klass) spell_checker = DidYouMean::SpellChecker.new(dictionary: klass.public_methods) corrections = spell_checker.correct(input) super(<<~STRING.chomp Undefined Faker method "#{input}" for "#{klass}". #{DidYouMean::Formatter.(corrections)} For available methods for this class, please check https://github.com/faker-ruby/faker#generators. STRING ) end |