我似乎无法在水豚下加载页面。该应用程序在localhost:3000/secure
下命名,但我认为其中的所有设置都已到位。我看到capybara点击服务器日志,看起来它正常加载页面并返回状态200.但是当我尝试查看页面时输出总是相同的,空的html页面。
它曾向我显示服务器错误(500和404)。但是一旦我在控制器中修复它们,没有任何反应
rspec的:
it 'should update the record normally for married status' do
visit edit_members_bene_partner_path
save_and_open_page
end
html的输出是:
<html><head></head><body></body></html>
rspec helper:
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rspec/rails'
require 'capybara/rspec'
require 'capybara/rails'
require 'capybara/poltergeist'
require 'capybara-screenshot/rspec'
require 'factory_girl_rails'
# settings for capybara
Capybara.configure do |config|
config.javascript_driver = :poltergeist
config.default_wait_time = 5
config.app_host = 'localhost:3000/secure'
config.run_server = true
end
RSpec.configure do |config|
config.include Capybara::DSL
config.include FactoryGirl::Syntax::Methods
config.include Rails.application.routes.url_helpers
end
答案 0 :(得分:1)
正如@Godwin建议的那样,将'http://'添加到Capybara的config.app_host
解决了问题