我最近开始在我的 Rails 应用程序中使用 RSpec 进行集成测试,以避免必须与多个测试框架保持同步,并且正在将我的 Cucumber 功能转换为 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-rails (2.8.1)