diff options
| author | Randy Morgan <[email protected]> | 2011-11-20 23:22:04 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2011-11-20 23:22:04 +0900 |
| commit | e53f04284618713b0a90b7a691425c380e829476 (patch) | |
| tree | 801fea138160f9af426d62bf94ad5bf97123ece9 /test/doc_props/tc_core.rb | |
| download | caxlsx-e53f04284618713b0a90b7a691425c380e829476.tar.gz caxlsx-e53f04284618713b0a90b7a691425c380e829476.zip | |
first commit
Diffstat (limited to 'test/doc_props/tc_core.rb')
| -rw-r--r-- | test/doc_props/tc_core.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/doc_props/tc_core.rb b/test/doc_props/tc_core.rb new file mode 100644 index 00000000..5dd490a8 --- /dev/null +++ b/test/doc_props/tc_core.rb @@ -0,0 +1,34 @@ +require 'test/unit' +require 'axlsx.rb' + +class TestCore < Test::Unit::TestCase + + def setup + @core = Axlsx::Core.new + @doc = Nokogiri::XML(@core.to_xml) + end + + def test_valid_document + schema = Nokogiri::XML::Schema(File.open(Axlsx::CORE_XSD)) + errors = [] + schema.validate(@doc).each do |error| + puts error.message + errors << error + end + assert_equal(errors.size, 0, "core.xml Invalid" + errors.map{ |e| e.message }.to_s) + end + + def test_populates_created + assert_equal(@doc.xpath('//dcterms:created').text, Time.now.strftime('%Y-%m-%dT%H:%M:%S'), "dcterms:created incorrect") + end + + def test_populates_default_name + assert_equal(@doc.xpath('//dc:creator').text, "axlsx", "Default name not populated") + end + + def test_creator_as_option + c = Axlsx::Core.new :creator => "some guy" + doc = Nokogiri::XML(c.to_xml) + assert(doc.xpath('//dc:creator').text == "some guy") + end +end |
