Newbie: Rspec, Webrat, Mechanize, Cucumber

Alright, I’m trying to get up to speed with using Rspec, Webrat,
Mechanize and Cucumber to test a non rails application.

The RSpec Matchers (I think) seem to not be working as expected. When
I run my feature, it says the world cannot find the method “contain”

I have the following gems installed:
cucumber 0.3.2
rspec 1.2.6
mechanize 0.9.2
webrat 0.4.4

My feature is as follows:
Feature: Google
In order to buy a sweet new laptop
As a apple enthusiest
I want to find

Scenario: Search for apple
Given I visit “
When I fill in “q” with “
And I press “Google Search”
Then I should see “

require ‘webrat’

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

require ‘webrat/core/matchers’
require ‘webrat/mechanize’
class MechanizeWorld < Webrat::MechanizeSession
require ‘spec’
include Spec::Matchers

World do


Given /^I visit “(.*)”$/ do |url|

When I run the feature, everything passes except for the last step,
“should see”
Then /^I should see “([^”]*)"$/ do |text|
response.should contain(text)

The error it gives is:

Then I should see ""
  undefined method `contain' for #<MechanizeWorld:0x429aa64>

./features/step_definitions/webrat_steps.rb:94:in /^I should see "([^\"]*)"$/' features/google.feature:10:inThen I should see”’

As far as I know, contain is an rspec matcher which is getting
included in MechanizeWorld, but it doesn’t seem to be working

Any ideas?

contain is a webrat method.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs