summaryrefslogtreecommitdiffhomepage
path: root/test/doc_props/tc_core.rb
diff options
context:
space:
mode:
authorStefan Daschek <[email protected]>2013-06-12 23:08:14 +0200
committerStefan Daschek <[email protected]>2013-06-12 23:08:14 +0200
commit0ec328213fbe31cd4456dceecda6d7ba8d1c9021 (patch)
treeb884e542ed423239ecac7bddefcfaede1c2d39a6 /test/doc_props/tc_core.rb
parent00cb09391927aaea08de304f3faad3afdbff2b18 (diff)
downloadcaxlsx-0ec328213fbe31cd4456dceecda6d7ba8d1c9021.tar.gz
caxlsx-0ec328213fbe31cd4456dceecda6d7ba8d1c9021.zip
Allow overriding the 'created' timestamp in the docprops.
Can be specified as option to Package#new: ``` Axlsx::Package.new :created_at => time ``` If omitted, the current time at the moment the document is serialized will be used. This change is therefore fully backward compatible.
Diffstat (limited to 'test/doc_props/tc_core.rb')
-rw-r--r--test/doc_props/tc_core.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/doc_props/tc_core.rb b/test/doc_props/tc_core.rb
index cfff4d59..0eddfed7 100644
--- a/test/doc_props/tc_core.rb
+++ b/test/doc_props/tc_core.rb
@@ -23,6 +23,13 @@ class TestCore < Test::Unit::TestCase
assert_equal(@doc.xpath('//dcterms:created').text, @time, "dcterms:created incorrect")
end
+ def test_created_as_option
+ time = Time.utc(2013, 1, 1, 12, 00)
+ c = Axlsx::Core.new :created => time
+ doc = Nokogiri::XML(c.to_xml_string)
+ assert_equal(doc.xpath('//dcterms:created').text, time.xmlschema, "dcterms:created incorrect")
+ end
+
def test_populates_default_name
assert_equal(@doc.xpath('//dc:creator').text, "axlsx", "Default name not populated")
end