RSpec 2.6 + Capybara 1.0 incompatibility

Hi.

I use RSpec-Rails 2.6.1 together with Capybara 1.0.0.

Whenever I start my integration (request) tests I get the following
error:

Failure/Error: page.execute_script(’$
(“div.editable:first”).trigger(“mouseover”);’)
Selenium::WebDriver::Error::UnexpectedJavascriptError:
$ is not defined

It seems that it can’t find jQuery in there. Another strange thing is
that it doesn’t start the browser at all when telling Capybara to use
the Selenium driver.

Why do I write this here!? Because when I switch back to RSpec 2.5
everything runs fine again. Do I have to re-configure something for
RSpec 2.6? Any clue what the cause could be?

Regards,
Kai

Here is also the spec helper I use for my integration tests:

ENV[“RAILS_ENV”] ||= ‘test’
require File.expand_path("…/…/config/environment", FILE)
require ‘rspec/rails’
require ‘webrat’
require ‘capybara/rspec’
require “database_cleaner”

Dir["#{File.dirname(FILE)}/support/**/*.rb"].each {|f| require f}

RSpec.configure do |config|
config.filter_run :focus => true
config.run_all_when_everything_filtered = true
config.filter_run_excluding :exclude => true
config.use_transactional_fixtures = false
config.mock_with :rspec

config.before(:all) do
DatabaseCleaner.strategy = :truncation
DatabaseCleaner.clean
end

config.after(:each) do
DatabaseCleaner.clean
Sunspot.remove_all!
end
end

Webrat.configure do |config|
config.mode = :rails
end

On Jun 17, 2011, at 2:20 PM, Kai S. wrote:

end

config.after(:each) do
DatabaseCleaner.clean
Sunspot.remove_all!
end
end

Webrat.configure do |config|
config.mode = :rails
end

Webrat and Capybara are not compatible, as they each do similar things
in different ways. This wasn’t a visible issue in rspec-rails-2.5
because capybara was only mixed in to request specs, but 2.6 mixes it
into view and helper specs as well.

HTH,
David

Thank you, David. After removing the Webrat stuff everything runs
perfectly again.

Regards,
Kai

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