I'm following Michael Hartl Ruby on Rails tutorial. At the end of paragraph 5.3.1 I'm running the tests that we've programmed as part of the tutorial. For all 4 tests/views it generates the following error:
ERROR["test_should_get_about", StaticPagesControllerTest, 0.207317345] test_should_get_about#StaticPagesControllerTest (0.21s) ActionView::Template::Error: ActionView::Template::Error: Missing partial layouts/_shim with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :jbuilder]}. Searched in:
* "/usr/local/rvm/gems/ruby-2.1.5@rails4/gems/web-console-2.0.0.beta3/lib/action_dispatch/templates"
* "/home/ubuntu/workspace/sample_app/app/views"
* "/usr/local/rvm/gems/ruby-2.1.5@rails4/gems/web-console-2.0.0.beta3/app/views"
app/views/layouts/application.html.erb:9:in `_app_views_layouts_application_html_erb___3690625791535586393_66697380'
test/controllers/static_pages_controller_test.rb:17:in `block in <class:StaticPagesControllerTest>'
app/views/layouts/application.html.erb:9:in `_app_views_layouts_application_html_erb___3690625791535586393_66697380'
test/controllers/static_pages_controller_test.rb:17:in `block in <class:StaticPagesControllerTest>'
I have a file app/views/layouts/_shim.html.erb, so that seems okay, and application.html.erb is:
<!DOCTYPE html>
<html>
<head>
<title><%= full_title(yield(:title)) %></title>
<%= stylesheet_link_tag "application", media: "all",
"data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= csrf_meta_tags %>
<%= render 'layouts/shim' %>
</head>
<body>
<%= render 'layouts/header' %>
<div class="container">
<%= yield %>
<%= render 'layouts/footer' %>
</div>
</body>
</html>
The test is:
test "should get about" do
get :about
assert_response :success
assert_select "title", "About | Ruby on Rails Tutorial Sample App"
end
I don't understand what what causes the error. In the controller it just read def about; end and the routes get 'static_pages/about'
The project structure is:
- Sample_app
- .bundle
- .git
- App
- Assets
- Images
- Javascripts
- Stylesheets
- Controllers
- Helpers
- Mailers
- Models
- Views
- layouts
- _footer.html.erb
- _header.html.erb
- _shim.html.erb
- application.html.erb
- static_pages
- about.html.erb
- contact.html.erb
- help.html.erb
- home.html.erb
- layouts
- Assets
- Bin
- Config
- Db
- Lib
- Log
- Public
- Spring