我试图掌握 TDD 的一些概念,在我的 RoR 应用程序中,我有 /about 视图,它属于 static_pages#about。它在routes.rb中定义了路由get 'about' => 'static_pages#about'。到目前为止,一切都可以在浏览器中运行,但我也想通过 RSpec 来测试它。给定
RSpec.describe "about.html.erb", type: :view do
it "renders about view" do
render :template => "about"
expect(response).to render_template('/about')
end
end
Run Code Online (Sandbox Code Playgroud)
引发错误
Missing template /about with {:locale=>[:en], :formats=>[:html, :text, :js, :css, :ics, :csv, :vcf, :png, :......
Run Code Online (Sandbox Code Playgroud)
谢谢!