Hi,
I am trying to run rspec testcase using webrat but it is showing me an
error as "undefined method `last_response'' for
#<Capybara::Document>"
Following are my configurations:
Gemfile:
roup :development, :test do
gem ''sqlite3-ruby'', :require => ''sqlite3''
gem "rspec", "=2.4.0"
gem "rspec-rails", "2.4.0"
#gem "rspec", ">= 2.0.0.beta.16"
#gem "rspec-rails", ">= 2.0.0.beta.16"
gem ''webrat'', ''>=0.7.2.beta.6'', :git
=>
''git://github.com/orangewise/webrat.git''
gem "autotest"
gem "autotest-rails"
gem "factory_girl", "=2.0.0.beta1"
gem ''capybara''
gem "launchy"
#gem ''autotest-fsevent''
end
spec/spec_helper
ENV["RAILS_ENV"] ||= ''test''
require File.expand_path("../../config/environment", __FILE__)
require ''rspec/rails''
require ''rspec/core''
require ''rspec/matchers''
require ''webrat/core/matchers''
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
require ''webrat''
require ''webrat/core/matchers''
include Webrat::Methods
include Webrat::Matchers
Webrat.configure do |config|
config.mode = :rack
end
#World(Webrat::Methods)
#World(Webrat::Matchers)
RSpec.configure do |config|
config.include Rack::Test::Methods
# == Mock Framework
#
# If you prefer to use mocha, flexmock or RR, uncomment the
appropriate line:
#
# config.mock_with :mocha
# config.mock_with :flexmock
# config.mock_with :rr
config.mock_with :rspec
# Remove this line if you''re not using ActiveRecord or ActiveRecord
fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"
# If you''re not using ActiveRecord, or you''d prefer not to run
each of
your
# examples within a transaction, remove the following line or assign
false
# instead of true.
config.use_transactional_fixtures = true
include Webrat::Methods
include Webrat::Matchers
end
Initially my spec was under spec/models/file_name,after searching i
change the path to spec/integratation/file_name but no success
Also initially i was using rspec version 2.0.0.beta.16 but after
searching i found that for webrat the version required for rspec is
2.40.
I also installed that version but no success.
Also i want to know since my application is running on rails3,will the
change in version of rspec will effect running the specs
--
Posted via http://www.ruby-forum.com/.
David Chelimsky
2011-Mar-08 15:36 UTC
[rspec-users] problem running rspec test with Webrat
On Mar 8, 2011, at 8:10 AM, Amit Kulkarni wrote:> Hi, > I am trying to run rspec testcase using webrat but it is showing me an > error as "undefined method `last_response'' for #<Capybara::Document>" > > Following are my configurations: > Gemfile: > > roup :development, :test do > gem ''sqlite3-ruby'', :require => ''sqlite3'' > gem "rspec", "=2.4.0" > gem "rspec-rails", "2.4.0" > #gem "rspec", ">= 2.0.0.beta.16" > #gem "rspec-rails", ">= 2.0.0.beta.16" > gem ''webrat'', ''>=0.7.2.beta.6'', :git => > ''git://github.com/orangewise/webrat.git'' > gem "autotest" > gem "autotest-rails" > gem "factory_girl", "=2.0.0.beta1" > gem ''capybara'' > gem "launchy"You should use webrat or capybara, but not both. Cheers, David