[rspec-users] webrat within selector
jonathan at parkerhill.com
Tue Oct 14 02:51:34 EDT 2008
yeah, my case is a step like When "I click on the $tab tab"... I want
to make sure its a link in a tab, not some other link on the page
with the same text
On Oct 14, 2008, at 2:13 AM, Bryan Helmkamp wrote:
> This should work:
> within "#user_43" do |scope|
> scope.click_link "Edit"
> If you're using Rails' record identification HTML helpers, you can do
> something like within('#' + dom_id(user)) to save some typing.
> Scott's right that I'd recommend avoiding targeting IDs when possible,
> but Webrat supports it in a few ways for cases where it's needed.
> On Mon, Oct 13, 2008 at 3:36 PM, Scott Taylor
> <mailing_lists at railsnewbie.com> wrote:
>> On Oct 13, 2008, at 1:54 PM, Jonathan Linowes wrote:
>>> anyone know if/how webrat can scope a clicks_link within a
>>> selector? eg,
>>> if I have more than one "Foo" link on a page, I want to make sure
>>> I click
>>> the one within a specific div
>> I'm pretty sure clicks link can also take an id. It's not the
>> solution (in fact, I'm sure Bryan would say webrat was developed to
>> *explicitly* so that you wouldn't use an id...but I digress).
>> rspec-users mailing list
>> rspec-users at rubyforge.org
> Bryan Helmkamp
> http://brynary.com -- My blog
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users