Sha256: 35aed83bbd403c4abc337502dbbfaddc7e51d30c742ace2e21f8f587f3e0f04b

Contents?: true

Size: 664 Bytes

Versions: 2

Compression:

Stored size: 664 Bytes

Contents

require_relative 'test_helper'

class ModelParserTest < ParserTest
  def test_parses_money
    xml = <<-EOF
    <Price xmlns="example">
      <CurrencyCode>USD</CurrencyCode>
      <Amount>10.00</Amount>
    </Price>
    EOF
    model = Parser::Model.new(Nokogiri(xml))
    money = model.money_at_xpath('Price')
    assert_equal '$10.00', money.format
  end

  def test_parses_japanese_yen
    xml = <<-EOF
    <Price xmlns="example">
      <CurrencyCode>JPY</CurrencyCode>
      <Amount>1000.00</Amount>
    </Price>
    EOF
    model = Parser::Model.new(Nokogiri(xml))
    money = model.money_at_xpath('Price')
    assert_equal '¥1,000', money.format
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mws-orders-0.0.2 test/parsers/model_test.rb
mws-orders-0.0.1 test/parsers/model_test.rb