Skip to content

empty string is causing NoMethodError rather than Ingreedy::ParseFailed #34

@matkoniecz

Description

@matkoniecz

I would expect

require 'ingreedy'

Ingreedy.parse('')

to throw Ingreedy::ParseFailed rather than NoMethodError

/home/mateusz/.gem/ruby/2.3.0/gems/ingreedy-0.1.0/lib/ingreedy/unit_variation_mapper.rb:31:in `unit_from_variation': undefined method `first' for nil:NilClass (NoMethodError)
    from /home/mateusz/.gem/ruby/2.3.0/gems/ingreedy-0.1.0/lib/ingreedy/ingreedy_parser.rb:55:in `convert_unit_variation_to_canonical'
    from /home/mateusz/.gem/ruby/2.3.0/gems/ingreedy-0.1.0/lib/ingreedy/ingreedy_parser.rb:39:in `parse'
    from /home/mateusz/.gem/ruby/2.3.0/gems/ingreedy-0.1.0/lib/ingreedy.rb:16:in `parse'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions