Rspec 为什么一系列规范在每个规范成功时失败?

Rspec 为什么一系列规范在每个规范成功时失败?,rspec,capybara,capybara-webkit,Rspec,Capybara,Capybara Webkit,在具有Rspec 2.12.0的Capybara 2.1.0上: 如果我运行$rspec spec/features/user\u查看排行榜\u spec.rb,则规格通过 如果我运行$rspec spec/features/*,测试将失败,并声明: Capybara::ElementNotFound: Unable to find css "#flash" 如果我执行保存并打开页面,#flash将出现并可见 以下是发生故障的帮助器: def sign_in_as(user) vis

在具有Rspec 2.12.0的Capybara 2.1.0上:

如果我运行
$rspec spec/features/user\u查看排行榜\u spec.rb
,则规格通过

如果我运行
$rspec spec/features/*
,测试将失败,并声明:

Capybara::ElementNotFound:
   Unable to find css "#flash"
如果我执行
保存并打开页面
,#flash将出现并可见

以下是发生故障的帮助器:

def sign_in_as(user)
  visit new_user_session_path
  fill_in "Email", with: user.email
  fill_in "Password", with: user.password
  click_button "Sign In"
  flash = find("#flash")

  flash.should have_content "You are now signed in."
end
有什么想法吗?我是水豚的新手,所以不知道从哪里开始。谢谢

编辑/更新: 通过对一组在一起运行时失败的规范执行
save_和\u open_page
,我能够看到一系列成功,然后是一系列页面,除了body标签中的“Not Found”之外,什么也没说。谷歌没有发现任何东西——想法

更新#2
我注意到BODY中的“未找到”内容是在一个使用capybara webkit运行javascript的规范之后开始的。即使在after(:all)块中显式重置Capybara.current\u driver=:rack\u测试也不能解决问题,但我认为这是相关的。

虽然仍然不能100%确定这是什么原因,但从使用Capybara webkit的测试中删除
Capybara.automatic\u reload=false
解决了问题