summaryrefslogtreecommitdiff
path: root/features
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-04-28 15:37:04 -0400
committerRobert Speicher <rspeicher@gmail.com>2015-04-30 16:35:26 -0400
commita3fbf344693957ed0f39171400efa706b3a8709c (patch)
tree0970915ae8d680ceae92f4074fe7516f5568ef0d /features
parentfad015764cb2d550af0210e2158ecdead4b4bdeb (diff)
downloadgitlab-ce-a3fbf344693957ed0f39171400efa706b3a8709c.tar.gz
Fix header_should_have_correct_id_and_link for features
Diffstat (limited to 'features')
-rw-r--r--features/steps/shared/markdown.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/features/steps/shared/markdown.rb b/features/steps/shared/markdown.rb
index e71700880cd..a7231c47d14 100644
--- a/features/steps/shared/markdown.rb
+++ b/features/steps/shared/markdown.rb
@@ -2,8 +2,12 @@ module SharedMarkdown
include Spinach::DSL
def header_should_have_correct_id_and_link(level, text, id, parent = ".wiki")
- find(:css, "#{parent} h#{level}##{id}").text.should == text
- find(:css, "#{parent} h#{level}##{id} > :last-child")[:href].should =~ /##{id}$/
+ node = find("#{parent} h#{level} a##{id}")
+ node[:href].should == "##{id}"
+
+ # Work around a weird Capybara behavior where calling `parent` on a node
+ # returns the whole document, not the node's actual parent element
+ find(:xpath, "#{node.path}/..").text.should == text
end
def create_taskable(type, title)