[rspec-users] webrat methods are undefined

Amit Kulkarni lists at ruby-forum.com
Wed Mar 10 09:06:17 EST 2010


Hello,
I recently updated rspec-rails from  1.1.12 to 1.3.0 and rspec from 
1.1.12 to 1.3.0
Now while running cucumber i am facing a problem.
It says as 'undefined method 'visit''
my cucumber version is 0.3.99 and webrat version is 0.7.0.
Before upgrading the gem it ran well but now above error is displayed.
My env.rb file is as follows:

ENV["RAILS_ENV"] ||= "test"
require File.expand_path(File.dirname(__FILE__) + 
'/../../config/environment')
require 'cucumber/rails/world'

# Comment out the next line if you don't want Cucumber Unicode support
require 'cucumber/formatter/unicode'

# Comment out the next line if you don't want transactions to
# open/roll back around each scenario
Cucumber::Rails.use_transactional_fixtures

Before do
  Fixtures.reset_cache
  fixtures_folder = File.join(RAILS_ROOT, 'spec', 'fixtures')
  fixtures = Dir[File.join(fixtures_folder, '*.yml')].map {|f| 
File.basename(f, '.yml') }
  Fixtures.create_fixtures(fixtures_folder, fixtures)
end

# Comment out the next line if you want Rails' own error handling
# (e.g. rescue_action_in_public / rescue_responses / rescue_from)
Cucumber::Rails.bypass_rescue
require 'webrat'
require 'cucumber/webrat/element_locator' # Lets you do 
table.diff!(element_at('#my_table_or_dl_or_ul_or_ol').to_table)

Webrat.configure do |config|
  config.mode = :rails
end
require 'cucumber/rails/rspec'
require 'webrat/core/matchers'

Also my config/environments/cucumber.rb contains

config.cache_classes = true # This must be true for Cucumber to operate 
correctly!

# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true

# Show full error reports and disable caching
config.action_controller.consider_all_requests_local = true
config.action_controller.perform_caching             = false

# Disable request forgery protection in test environment
config.action_controller.allow_forgery_protection    = false

# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test

config.gem 'cucumber',    :lib => false,        :version => '>=0.3.99' 
unless File.directory?(File.join(Rails.root, 'vendor/plugins/cucumber'))
config.gem 'webrat',      :lib => false,        :version => '>=0.7.0' 
unless File.directory?(File.join(Rails.root, 'vendor/plugins/webrat'))
config.gem 'rspec',       :lib => false,        :version => '>=1.3.0' 
unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec'))
config.gem 'rspec-rails', :lib => 'spec/rails', :version => '>=1.3.2' 
unless File.directory?(File.join(Rails.root, 
'vendor/plugins/rspec-rails'))

Please suggest
-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list