Sha256: 827760729e580be6ab3991bef1cdb2d9dfad010e28bb97be3d881b472d70eacc

Contents?: true

Size: 900 Bytes

Versions: 1

Compression:

Stored size: 900 Bytes

Contents

# encoding: UTF-8

require 'spec_helper'

describe Unicafe::PriceParser do

  let!(:parser) {Unicafe::PriceParser.new}

  it "should replace maukkaasti with correct value" do
    parser.parse("Maukkaasti").should == Unicafe::PriceParser::MAUKKAASTI
  end

  it "should replace edullisesti with correct value" do
    parser.parse("Edullisesti").should == Unicafe::PriceParser::EDULLISESTI
  end

  it "should replace kevyesti with correct value" do
    parser.parse("Kevyesti").should == Unicafe::PriceParser::KEVYESTI
  end

  it "should replace makeasti with one value" do
    parser.parse("Makeasti 1,20€").should == '1.20'
  end

  it "should replace makeasti with another value" do
    parser.parse("Makeasti 1,00€").should == '1.00'
  end

  it "should raise error when not supported value" do
    expect{parser.parse("Trololoo")}.to raise_error(Unicafe::PriceParser::PriceError)
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
unicafe-0.0.3 spec/unicafe/price_parser_spec.rb