简体   繁体   中英

Rails 3.1 capybara javascript test access denied

I've just upgraded to Rails 3.1 and now when I try and run my cucumber (capybara) tests with the @javascript tag I get the following error:

The requested URL could not be retrieved
While trying to retrieve the URL: http://127.0.0.1:9987/login

The following error was encountered
    * Access Denied

I have the following defined in my features/support/env.rb file:

if defined?(ActiveRecord::Base)
  begin
    require 'database_cleaner'
    require 'database_cleaner/cucumber'
    DatabaseCleaner.strategy = :truncation
  rescue LoadError => ignore_if_database_cleaner_not_present
  end
end

Capybara.server_port = 9987 + ENV['TEST_ENV_NUMBER'].to_i

Have you explicitly applied this server port to the Capybara.app_host?

Capybara.app_host = "http://dev.local:#{Capybara.server_port}"

Using this configuration I have no issues with current Rails 3.1 and capybara-webkit.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM