require 'rails_helper'

RSpec.describe YieldParser do

  it 'parses various strings' do
    expect(YieldParser.parse('4')).to eq YieldParser::Result.new(4.0, 'each')
    expect(YieldParser.parse('4 servings')).to eq YieldParser::Result.new(4.0, 'serving')
    expect(YieldParser.parse('3 pancakes')).to eq YieldParser::Result.new(3.0, 'pancake')
    expect(YieldParser.parse('13.5 large croutons')).to eq YieldParser::Result.new(13.5, 'large crouton')

    expect(YieldParser.parse('1 1/2 pints')).to eq YieldParser::Result.new(1.5, 'pint')
  end

end