Sha256: f56c9ddf65dfbcf5fc7ceaeba98de2f486b6240f074058c5eea1565346d6da91
Contents?: true
Size: 763 Bytes
Versions: 4
Compression:
Stored size: 763 Bytes
Contents
require 'helper' require 'peddler/parsers/model' require 'nokogiri' class PeddlerModelParserTest < MiniTest::Test def build(xml) document = Nokogiri(xml) Peddler::Parsers::Model.new(document) end def test_parses_money xml = <<-EOF <Price xmlns="example"> <CurrencyCode>USD</CurrencyCode> <Amount>10.00</Amount> </Price> EOF model = build(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 = build(xml) money = model.money_at_xpath('Price') assert_equal '¥1,000', money.format end end
Version data entries
4 entries across 4 versions & 1 rubygems