Fix header_should_have_correct_id_and_link for features

This commit is contained in:
Robert Speicher 2015-04-28 15:37:04 -04:00
parent fad015764c
commit a3fbf34469
1 changed files with 6 additions and 2 deletions

View File

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