#234 ✓resolved
tomo

have_selector and have_xpath don't match descendants in blocks

Reported by tomo | April 29th, 2009 @ 02:52 AM

HaveXpath (and thus HaveSelector) replace %r'//' with './' in the xpath query within a block. This prevents matchers inside the block from matching parents of the matched nodes. It also prevents matchers inside the block from matching arbitrary descendants of the matched nodes. See http://gist.github.com/103587 for an example.

Also, if the query xpath happened to have more than one '//' in it (e.g. '//foo//bar'), wouldn't this be severely screwed up ('./foo./bar')?

I think this can be solved by instead replacing %r'^//' with './/'. I've forked webrat and added a couple tests: http://github.com/tomo/webrat. Making this change didn't break any tests, but I'm not very confident that it doesn't introduce any bugs.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Ruby Acceptance Testing for Web applications.

Shared Ticket Bins

People watching this ticket

Referenced by

Pages