summaryrefslogtreecommitdiffhomepage
path: root/test/content_type
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2012-03-11 13:04:11 +0900
committerRandy Morgan <[email protected]>2012-03-11 13:04:11 +0900
commitb8fcb4a6b78cf0419487353d098d12671909c7e2 (patch)
treef2baa4ecce428ac3c0b2860ff0cd8c7a887c3f94 /test/content_type
parent2cc042f2d19d5b7a0846648a97b5a3954d0f25ed (diff)
downloadcaxlsx-b8fcb4a6b78cf0419487353d098d12671909c7e2.tar.gz
caxlsx-b8fcb4a6b78cf0419487353d098d12671909c7e2.zip
no, really _fix_ the namespaced css doc selectors to use xpath and prefixed nodes...
Diffstat (limited to 'test/content_type')
-rw-r--r--test/content_type/tc_content_type.rb22
1 files changed, 11 insertions, 11 deletions
diff --git a/test/content_type/tc_content_type.rb b/test/content_type/tc_content_type.rb
index 05b3d93c..5757b980 100644
--- a/test/content_type/tc_content_type.rb
+++ b/test/content_type/tc_content_type.rb
@@ -50,34 +50,34 @@ class TestContentType < Test::Unit::TestCase
end
def test_should_get_worksheet_for_worksheets
- o_path = "Types Override [@ContentType='%s']"
+ o_path = "//xmlns:Override[@ContentType='%s']"
ws = @package.workbook.add_worksheet
doc = Nokogiri::XML(@package.send(:content_types).to_xml)
- assert_equal(doc.css("Types Override").size, 5, "adding a worksheet should add another type")
- assert_equal(doc.css(o_path % Axlsx::WORKSHEET_CT).last["PartName"], "/xl/#{ws.pn}", "Worksheet part invalid")
+ assert_equal(doc.xpath("//xmlns:Override").size, 5, "adding a worksheet should add another type")
+ assert_equal(doc.xpath(o_path % Axlsx::WORKSHEET_CT).last["PartName"], "/xl/#{ws.pn}", "Worksheet part invalid")
ws = @package.workbook.add_worksheet
doc = Nokogiri::XML(@package.send(:content_types).to_xml)
- assert_equal(doc.css("Types Override").size, 6, "adding workship should add another type")
- assert_equal(doc.css(o_path % Axlsx::WORKSHEET_CT).last["PartName"], "/xl/#{ws.pn}", "Worksheet part invalid")
+ assert_equal(doc.xpath("//xmlns:Override").size, 6, "adding workship should add another type")
+ assert_equal(doc.xpath(o_path % Axlsx::WORKSHEET_CT).last["PartName"], "/xl/#{ws.pn}", "Worksheet part invalid")
end
def test_drawings_and_charts_need_content_types
- o_path = "Types Override [@ContentType='%s']"
+ o_path = "//xmlns:Override[@ContentType='%s']"
ws = @package.workbook.add_worksheet
c = ws.add_chart Axlsx::Pie3DChart
doc = Nokogiri::XML(@package.send(:content_types).to_xml)
- assert_equal(doc.css("Types Override").size, 7, "expected 7 types got #{doc.css("Types Override").size}")
- assert_equal(doc.css(o_path % Axlsx::DRAWING_CT).first["PartName"], "/xl/#{ws.drawing.pn}", "Drawing part name invlid")
- assert_equal(doc.css(o_path % Axlsx::CHART_CT).last["PartName"], "/xl/#{c.pn}", "Chart part name invlid")
+ assert_equal(doc.xpath("//xmlns:Override").size, 7, "expected 7 types got #{doc.css("Types Override").size}")
+ assert_equal(doc.xpath(o_path % Axlsx::DRAWING_CT).first["PartName"], "/xl/#{ws.drawing.pn}", "Drawing part name invlid")
+ assert_equal(doc.xpath(o_path % Axlsx::CHART_CT).last["PartName"], "/xl/#{c.pn}", "Chart part name invlid")
c = ws.add_chart Axlsx::Pie3DChart
doc = Nokogiri::XML(@package.send(:content_types).to_xml)
- assert_equal(doc.css("Types Override").size, 8, "expected 7 types got #{doc.css("Types Override").size}")
- assert_equal(doc.css(o_path % Axlsx::CHART_CT).last["PartName"], "/xl/#{c.pn}", "Chart part name invlid")
+ assert_equal(doc.xpath("//xmlns:Override").size, 8, "expected 7 types got #{doc.css("Types Override").size}")
+ assert_equal(doc.xpath(o_path % Axlsx::CHART_CT).last["PartName"], "/xl/#{c.pn}", "Chart part name invlid")
end
end