Using capybara (0.3.9) with steak and when running my steak acceptance spec with :js => true
, firefox is fired and it works.
But when I upgrade capybara
to 0.4.1.2
in Gemfile
and run the same spec, firefox is fired on port 9887 but the page just show Unable to connect
.
I think the selenium server couldn't fire.
This also affects my cucumber scenarios with @javascript
tag too.
Following is my spec_helper.rb
require 'spork'
Spork.prefork do
ENV["RAILS_ENV"] ||= 'test'
...
RSpec.configure do |config|
...
config.before(:each, :type => :acceptance) do
Capybara.reset_sessions!
Capybara.default_selector = :css
Capybara.default_driver = :selenium
Capybara.javascript_driver = :selenium
Capybara.current_driver = :selenium if example.metadata[:js]
end
config.after(:each, :type => :acceptance) do
Capybara.use_default_driver if example.metadata[:js]
end
end
end
Sp开发者_开发知识库ork.each_run do
load "#{Rails.root}/spec/Sporkfile.rb" if File.exists?("#{Rails.root}/spec/Sporkfile.rb")
end
and this is the acceptance_helper.rb
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
require "steak"
# Put your acceptance spec helpers inside /spec/acceptance/support
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
精彩评论