[rspec-users] webrat methods are undefined

Matt Wynne matt at mattwynne.net
Wed Jan 28 10:55:30 EST 2009

On 28 Jan 2009, at 15:15, Tom Hoen wrote:

> I am sure it is just a configuration issue, but when I use any of the
> steps in the webrat_steps.rb file, I get messages like:
> undefined method `click_link'
> I have the webrat gem installed (0.3.4). I have the aslakhellesoy- 
> webrat
> ( gem installed, and I have the webrat plugin installed.
> In my cucumber env.rb file I have the following.
>  require 'webrat' if !defined?(Webrat)
>  # Comment out the next two lines if you're not using RSpec's matchers
> (should   should_not) in your steps.
>  require 'cucumber/rails/rspec'
>  #require 'webrat/rspec-rails'
> So I am sure I have munged the setup. Any advice would be appreciated.

Hi Tom,

I should update to the new version of webrat (0.4) and cucumber (can't  
remember) as this stuff has gone through some churn but stabilised  
following that 0.4 release.

Check the webrat docs, but (with that new version) I think you need to  
do something like

Webrat.configure do |config|
   config.mode = :rails

You won't need the aslakhellesoy gem anymore either I don't think.

Please let us know if you were misguided by any out-of-date  

Matt Wynne

More information about the rspec-users mailing list