spec for descendant selectors in have_xpath block

This commit is contained in:
Thomas Jack 2009-05-13 14:52:53 -05:00
parent db9c5bdc77
commit 232ed36379
1 changed files with 7 additions and 1 deletions

View File

@ -89,11 +89,17 @@ describe "have_xpath" do
}.should raise_error(Spec::Expectations::ExpectationNotMetError) }.should raise_error(Spec::Expectations::ExpectationNotMetError)
end end
it "should work with descendants of the matched elements" do it "should match descendants of the matched elements in the block" do
@body.should have_xpath("//ul") do |node| @body.should have_xpath("//ul") do |node|
node.should have_xpath("//a[@href='http://example.org']") node.should have_xpath("//a[@href='http://example.org']")
end end
end end
it "should allow descendant selectors in the block" do
@body.should have_xpath("//div[@id='main']") do |node|
node.should have_xpath("//ul//a")
end
end
describe 'asserts for xpath' do describe 'asserts for xpath' do
include Test::Unit::Assertions include Test::Unit::Assertions