Forum: RSpec [webrat] click link by title doesn't work

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Andrew P. (Guest)
on 2009-03-13 13:00
(Received via mailing list)
Webrat 0.4.2 doesn't seem to allow you to click links by title. Am I
missing
something stupid?
With steps below running in sequence, first passes, second fails

Then /^I should see a view (\w+) details link$/ do |object|
  response.should have_tag("a[title=#{object}_details]")
end

When /^I follow view (\w+) details link$/ do |object|
  click_link "#{object}_details}"
end

I think click link should find by

- innerHTML, with simple   handling
-  title
-  id
-  class

Does anyone have any contradictory opinions?

In the meantime I'll have a bash at writing a patch for this

Cheers

Andrew
Balint E. (Guest)
on 2009-03-14 21:28
Andrew P. wrote:

>
> When /^I follow view (\w+) details link$/ do |object|
>   click_link "#{object}_details}"
> end

I think the problem is that you have an extra } in the title of the link
you are looking for. It should just be:

When /^I follow view (\w+) details link$/ do |object|
  click_link "#{object}_details"
end

Does this solve your problem?
Balint
Andrew P. (Guest)
on 2009-03-14 22:05
(Received via mailing list)
Doh!, thanks alot :).

2009/3/14 Balint E. <removed_email_address@domain.invalid>
This topic is locked and can not be replied to.