【发布时间】:2011-08-30 21:06:30
【问题描述】:
我是集成测试的新手,虽然我已经为我的模型和控制器做了很多单元测试。但现在我想测试整个堆栈。 (我不想用Cucumber,因为没有客户,我可以看代码)
这是我的(简化的)规范
describe ArticlesController, "#show" do
before do
@article = Factory :article, :title => "Lorem ipsum"
end
it "should show the article page" do
visit article_path(:id => @article)
page.should have_content("Lorem ipsum")
end
end
规范通过了,但是一旦我将:js => true 添加到it "should show the article page", :js => true do,ActiveRecord::RecordNotFound 就会被抛出。如果我在我的配置中禁用use_transactional_fixtures,它会再次工作,但这会破坏很多其他测试。是否有其他解决方案,或者我可以仅为我的集成测试禁用 transactional_fixtures?
感谢阅读! :)
【问题讨论】:
标签: ruby-on-rails rspec integration-testing acceptance-testing