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