From 232ed36379104484100f3aab1004872bc89cb6b5 Mon Sep 17 00:00:00 2001 From: Thomas Jack Date: Wed, 13 May 2009 14:52:53 -0500 Subject: [PATCH] spec for descendant selectors in have_xpath block --- spec/public/matchers/have_xpath_spec.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/spec/public/matchers/have_xpath_spec.rb b/spec/public/matchers/have_xpath_spec.rb index c51e385..28157a8 100644 --- a/spec/public/matchers/have_xpath_spec.rb +++ b/spec/public/matchers/have_xpath_spec.rb @@ -89,11 +89,17 @@ describe "have_xpath" do }.should raise_error(Spec::Expectations::ExpectationNotMetError) 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| node.should have_xpath("//a[@href='http://example.org']") 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 include Test::Unit::Assertions