我最近開始在我的Rails應用程序中使用RSpec進行集成測試,以避免不斷更新多個測試框架,並且正在將我的Cucumber功能轉換爲RSpec。正在運行兩次的RSpec集成測試示例
我已經順利拿到了1點積分試運行,但是,它似乎通過例如兩次運行:
rspec spec/integration/create_article_spec.rb -f documentation
admin creates article
successfully creates article
admin creates article
successfully creates article
Finished in 0.51816 seconds
2 examples, 0 failures
這裏是create_article_spec.rb的內容:
require 'spec_helper'
feature "admin creates article" do
scenario "successfully creates article" do
visit admin_articles_url
click_link "New Article"
fill_in "Title", with: "Test 1"
fill_in "Body", with: "Test Article"
click_button "Save"
page.should have_content "New Article Published"
end
end
我可以」找到任何可能發生的原因,發生這種情況的所有其他情況不適用於我的情況。
它只出現在我的集成測試中,所有其他測試似乎都沒有受到影響。
我希望有更多RSpec知識的人比我可以找出我可能會錯過的東西。
版本
的Rails(3.2.2) RSpec的(2.8.0) RSpec的護欄(2.8.1)
spec_helper.rb中有什麼奇怪的東西? – 2012-04-25 09:11:59
你使用spork?另外,你的Gemfile中有rspec-rails嗎? – 2012-05-10 08:46:14
撇開:如果你從黃瓜遷移,切換到蘿蔔可能會更容易,它運行在rspec上,但類似於黃瓜,因爲它使用了小黃瓜語法。請參閱https://github.com/jnicklas/turnip。 – Zubin 2012-05-14 20:40:18