水豚访问不加载页面

Capybara visit does not load the page

我似乎无法在水豚下加载页面。该应用程序在 localhost:3000/secure 下命名空间,但我认为那里的所有设置都已到位。我看到水豚命中服务器日志,它似乎正常加载页面并且 returns 状态为 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帮手:

# 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

正如@Godwin 所建议的那样,将 'http://' 添加到 Capybara 的 config.app_host 解决了问题