test/peddler/parsers/test_model.rb in peddler-0.6.3 vs test/peddler/parsers/test_model.rb in peddler-0.6.4

- old
+ new

@@ -29,6 +29,42 @@ EOF model = build(xml) money = model.money_at_xpath('Price') assert_equal '¥1,000', money.format end + + def test_parses_truthy_value + xml = <<-EOF + <Bool xmlns="example"> + true + </Bool> + EOF + model = build(xml) + assert_equal true, model.boolean_at_xpath('Bool') + + xml = <<-EOF + <Bool xmlns="example"> + Yes + </Bool> + EOF + model = build(xml) + assert_equal true, model.boolean_at_xpath('Bool') + end + + def test_parses_falsy_value + xml = <<-EOF + <Bool xmlns="example> + false + </Bool> + EOF + model = build(xml) + assert_equal false, model.boolean_at_xpath('Bool') + + xml = <<-EOF + <Bool xmlns="example> + No + </Bool> + EOF + model = build(xml) + assert_equal false, model.boolean_at_xpath('Bool') + end end