[rspec-users] Testing item links in Webrat (was: Cucumber)
matt at mattwynne.net
Mon Oct 27 04:09:41 EDT 2008
On 27 Oct 2008, at 00:01, Mark Thomson wrote:
> aslak hellesoy wrote:
>>> What I'm not sure about is whether it's possible to specify that a
>>> particular link gets clicked, since there are multiple links on
>>> the page
>>> with the same text. I'd like to be able to test that the
>>> particular database
>> Use the #clicks_link_within method in Webrat.
> Thanks Aslak. You've made me realize I have been looking at an old
> version of the documentation, here: http://www.brynary.com/uploads/webrat/rdoc/index.html
> . So I didn't realize there was a click_links_within method. Google
> has just led me here: http://webrat.rubyforge.org/.
The webrat code is very simple and readable IMO, even for a ruby
newbie like me. When I'm wondering how to do something, I usually just
open the source.
I think there's also a #within call which takes a block, so you might
be able to do something like.
within :div_for_object_123 do
clicks_link 'Follow Me'
This is based on a conversation I heard over the other side of the
desk, so take it with a pinch of salt ;)
More information about the rspec-users