Sha256: 9abe81dd597f402c11a6827810641790e6f7f3343ec4ed368efbde9edca89e1d
Contents?: true
Size: 872 Bytes
Versions: 5
Compression:
Stored size: 872 Bytes
Contents
require "minitest_helper" module Hermod describe XmlSection do DateTimeXml = XmlSection.build do |builder| builder.datetime_node :published builder.datetime_node :redacted, optional: true end describe "Date nodes" do subject do DateTimeXml.new do |dummy| dummy.published DateTime.new(2015, 3, 14, 12, 30, 56) end end it "should format the datetime with the given format string" do expect(value_of_node("Published")).must_equal "2015-03-14 12:30:56" end it "should raise an error if given something that isn't a date" do expect { subject.redacted "yesterday" }.must_raise InvalidInputError end it "should ignore blank dates if the date is optional" do subject.redacted nil expect(nodes("Redacted")).must_be_empty end end end end
Version data entries
5 entries across 5 versions & 1 rubygems