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
I have the following error when I run the integration tests :
NoMethodError: undefined method `visit' for
Here are the important files involving webrat :
gem 'rails', '3.0.12'
gem 'sqlite3', '1.3.3'
group :development do
gem 'annotate', '2.4.0'
group :development, :test do
gem 'webrat' , '0.7.1'
# I used 'bundle install'.
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
Webrat.configure do |config|
config.mode = :rails
class LayoutLinksTest < ActionDispatch::IntegrationTest
# 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.