From a1c88ddc9c90af608a2a5382271a28076f8fa925 Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Fri, 1 Mar 2013 18:39:32 +0100 Subject: [PATCH] fix broken tests on f18 because of nokogiri bug --- .../asciidoctor-disable-use-of-pending.patch | 13 ----- .../asciidoctor-fix-nth-child-selectors.patch | 50 +++++++++++++++++++ rubygem-asciidoctor.spec | 3 ++ 3 files changed, 53 insertions(+), 13 deletions(-) create mode 100644 patches/asciidoctor-fix-nth-child-selectors.patch diff --git a/patches/asciidoctor-disable-use-of-pending.patch b/patches/asciidoctor-disable-use-of-pending.patch index 725cbee..0da086e 100644 --- a/patches/asciidoctor-disable-use-of-pending.patch +++ b/patches/asciidoctor-disable-use-of-pending.patch @@ -1,19 +1,6 @@ # disables use of pending statement in the test suite The required gem, # pending, is not packaged in Fedora and since the statement is merely a task # note, it's safe to disable it's usage for the purpose of packaging. -diff --git a/test/attributes_test.rb b/test/attributes_test.rb -index 3e15eac..b683667 100644 ---- a/test/attributes_test.rb -+++ b/test/attributes_test.rb -@@ -177,7 +177,7 @@ To use {gem_name}, the first thing to do is to import it in your Ruby source fil - end - - test 'renders attribute until it is deleted' do -- pending 'This requires that we consume attributes as the document is being lexed, not up front' -+ #pending 'This requires that we consume attributes as the document is being lexed, not up front' - #output = render_string(":foo: bar\n\nCrossing the {foo}\n\n:foo!:\nBelly up to the {foo}") - # result = Nokogiri::HTML(html) - # assert_match /Crossing the bar/, result.css("p").first.content.strip diff --git a/test/test_helper.rb b/test/test_helper.rb index 3b27218..964ff59 100644 --- a/test/test_helper.rb diff --git a/patches/asciidoctor-fix-nth-child-selectors.patch b/patches/asciidoctor-fix-nth-child-selectors.patch new file mode 100644 index 0000000..803be16 --- /dev/null +++ b/patches/asciidoctor-fix-nth-child-selectors.patch @@ -0,0 +1,50 @@ +# Nokogiri is choking on assertions that use nth-child with a loose parent match +diff --git a/test/tables_test.rb b/test/tables_test.rb +index 5ccb92e..d86a70d 100644 +--- a/test/tables_test.rb ++++ b/test/tables_test.rb +@@ -21,8 +21,8 @@ context 'Tables' do + assert_css 'table td', output, 9 + assert_css 'table > tbody > tr > td.tableblock.halign-left.valign-top > p.tableblock', output, 9 + cells.each_with_index {|row, rowi| +- assert_css "table tr:nth-child(#{rowi + 1}) > td", output, row.size +- assert_css "table tr:nth-child(#{rowi + 1}) > td > p", output, row.size ++ assert_css "table > tbody > tr:nth-child(#{rowi + 1}) > td", output, row.size ++ assert_css "table > tbody > tr:nth-child(#{rowi + 1}) > td > p", output, row.size + row.each_with_index {|cell, celli| + assert_xpath "(//tr)[#{rowi + 1}]/td[#{celli + 1}]/p[text()='#{cell}']", output, 1 + } +@@ -272,21 +272,21 @@ d|9 2+>|10 + assert_css 'table > tbody > tr:nth-child(3) > td', output, 1 + assert_css 'table > tbody > tr:nth-child(4) > td', output, 2 + +- assert_css 'table tr:nth-child(1) > td:nth-child(1).halign-left.valign-top p em', output, 1 +- assert_css 'table tr:nth-child(1) > td:nth-child(2).halign-right.valign-top p strong', output, 1 +- assert_css 'table tr:nth-child(1) > td:nth-child(3).halign-center.valign-top p', output, 1 +- assert_css 'table tr:nth-child(1) > td:nth-child(3).halign-center.valign-top p *', output, 0 +- assert_css 'table tr:nth-child(1) > td:nth-child(4).halign-right.valign-top p strong', output, 1 ++ assert_css 'table > tbody > tr:nth-child(1) > td:nth-child(1).halign-left.valign-top p em', output, 1 ++ assert_css 'table > tbody > tr:nth-child(1) > td:nth-child(2).halign-right.valign-top p strong', output, 1 ++ assert_css 'table > tbody > tr:nth-child(1) > td:nth-child(3).halign-center.valign-top p', output, 1 ++ assert_css 'table > tbody > tr:nth-child(1) > td:nth-child(3).halign-center.valign-top p *', output, 0 ++ assert_css 'table > tbody > tr:nth-child(1) > td:nth-child(4).halign-right.valign-top p strong', output, 1 + +- assert_css 'table tr:nth-child(2) > td:nth-child(1).halign-center.valign-top p em', output, 1 +- assert_css 'table tr:nth-child(2) > td:nth-child(2).halign-center.valign-middle[colspan="2"][rowspan="2"] p tt', output, 1 +- assert_css 'table tr:nth-child(2) > td:nth-child(3).halign-left.valign-bottom[rowspan="3"] p tt', output, 1 ++ assert_css 'table > tbody > tr:nth-child(2) > td:nth-child(1).halign-center.valign-top p em', output, 1 ++ assert_css 'table > tbody > tr:nth-child(2) > td:nth-child(2).halign-center.valign-middle[colspan="2"][rowspan="2"] p tt', output, 1 ++ assert_css 'table > tbody > tr:nth-child(2) > td:nth-child(3).halign-left.valign-bottom[rowspan="3"] p tt', output, 1 + +- assert_css 'table tr:nth-child(3) > td:nth-child(1).halign-center.valign-top p em', output, 1 ++ assert_css 'table > tbody > tr:nth-child(3) > td:nth-child(1).halign-center.valign-top p em', output, 1 + +- assert_css 'table tr:nth-child(4) > td:nth-child(1).halign-left.valign-top p', output, 1 +- assert_css 'table tr:nth-child(4) > td:nth-child(1).halign-left.valign-top p em', output, 0 +- assert_css 'table tr:nth-child(4) > td:nth-child(2).halign-right.valign-top[colspan="2"] p tt', output, 1 ++ assert_css 'table > tbody > tr:nth-child(4) > td:nth-child(1).halign-left.valign-top p', output, 1 ++ assert_css 'table > tbody > tr:nth-child(4) > td:nth-child(1).halign-left.valign-top p em', output, 0 ++ assert_css 'table > tbody > tr:nth-child(4) > td:nth-child(2).halign-right.valign-top[colspan="2"] p tt', output, 1 + end + + test 'supports repeating cells' do diff --git a/rubygem-asciidoctor.spec b/rubygem-asciidoctor.spec index 7c88431..08b58ad 100644 --- a/rubygem-asciidoctor.spec +++ b/rubygem-asciidoctor.spec @@ -13,6 +13,8 @@ Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem # pending, is not packaged in Fedora and since the statement is merely a task # note, it's safe to disable it's usage for the purpose of packaging. Patch0: asciidoctor-disable-use-of-pending.patch +# Patch1: works around nth-child selector bug in Nokogiri +Patch1: asciidoctor-fix-nth-child-selectors.patch Requires: ruby(abi) = %{rubyabi} Requires: ruby(rubygems) Requires: ruby @@ -49,6 +51,7 @@ gem unpack -V %{SOURCE0} %setup -q -D -T -n %{gem_name}-%{version} gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec %patch0 -p1 +%patch1 -p1 %build mkdir -p .%{gem_dir}