Webrat installed but not working.


I am following the Ruby on Rails Tutorial
(http://ruby.railstutorial.org/) and i can't run the integration tests
using webrat (visit and click_link method for example). However, I am
using the default Test::Unit rather than RSpec but I don't think that is
an issue.

I have the following error when I run the integration tests :
NoMethodError: undefined method `visit' for

Here are the important files involving webrat :

source 'http://rubygems.org'
gem 'rails', '3.0.12'
gem 'sqlite3', '1.3.3'
group :development do
  gem 'annotate', '2.4.0'
group :development, :test do
  gem 'redgreen'
  gem 'webrat' , '0.7.1'
# I used 'bundle install'.

ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'redgreen'
require 'webrat'
Webrat.configure do |config|
  config.mode = :rails
class ActiveSupport::TestCase
  fixtures :all

require 'test_helper'
class LayoutLinksTest < ActionDispatch::IntegrationTest
  fixtures :all
  # Some tests.
  test "should have the right links on the layout" do
    visit root_path # Here it crashes.
    assert_select 'title', "Ruby on Rails Tutorial Sample App | Home"
    # Others assertitions

As you can see, I installed the gem, included webrat in the test helper
file and ran a simple test using webrat but it doesn't work...

I don't know where I made a mistake and any help would be appreciated.

Thank you!

So, I found the solution on another site and I share it here in case
someone gets stuck too.

In test_helper.rb, I replaced
  config.mode = :rails
  config.mode = :rack
and it works now.