fix broken tests on f18 because of nokogiri bug

This commit is contained in:
Dan Allen 2013-03-01 18:39:32 +01:00
parent 39eeeb008f
commit a1c88ddc9c
3 changed files with 53 additions and 13 deletions

View File

@ -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

View File

@ -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

View File

@ -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}