【发布时间】:2012-07-27 20:21:17
【问题描述】:
这真的让我措手不及。安装 haml-rails gem 后,stocks/index.html.haml 在浏览器中呈现没有问题。但是,当我尝试使用 rspec/capybara 进行测试时
describe "StockPages" do
describe "stocks/index.html.haml" do
before {visit stocks_path}
subject {page}
it { should have_selector('table#Result') }
end
end
我收到了这个错误:
Failure/Error: before {visit stocks_path}
ActionView::MissingTemplate:
Missing template stocks/index, application/index with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :coffee]}.
我该如何解决这个问题? 谢谢
【问题讨论】:
-
您是如何将
haml-railsgem 添加到您的Gemfile中的,它只在开发组中吗? -
我多么愚蠢!你说的对。所以我也应该将它包含在测试组中?生产怎么样?
标签: ruby-on-rails rspec haml