spec/public/matchers/have_xpath_spec.rb in diabolo-webrat-0.4.4.1 vs spec/public/matchers/have_xpath_spec.rb in diabolo-webrat-0.4.4.2

- old
+ new

@@ -11,10 +11,11 @@ <h3>Welcome 'Bryan'</h3> <h4>Welcome 'Bryan"</h4> <ul> <li>First</li> <li>Second</li> + <li><a href="http://example.org">Third</a></li> </ul> </div> HTML end @@ -84,9 +85,21 @@ lambda { @body.should have_xpath("//div[@class='inner']") do |node| node.should have_xpath("//div[@id='main']") end }.should raise_error(Spec::Expectations::ExpectationNotMetError) + end + + 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