In short:
The problem is that in the tutorial I am told to create a microposts resource, with its model and controller. When testing some of its actions with rspec, I am having “missing template” errors for create and destroy actions. But the tutorial doesnt say anything about creating views for these actions, and according to it these tests should be passing.
This my original, longer description of the problem:
I am doing the railstutorial.org, and having some problems in chapter 11.3.2. In listing 11.25, we write the tests for the Micropost create action. After running them, I get a template error, in ALL of them:
ActionView::MissingTemplate:
Missing template microposts/create with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>[:html], :locale=>[:en, :en]} in view paths "/Users/me/Dropbox/dev/rails/tutorial/app/views"
I am confused. The tutorial says nothing about creating views for these actions, and also that the tests should be passing at this point. Maybe a sign that I did something wrong is that the tutorial didnt mention the need to use generate to create the Microposts controller, but I used that.
This is my microposts controller:
class MicropostsController < ApplicationController
before_filter :authenticate
def create
end
def destroy
end
end
and my routes.rb
Secondappr::Application.routes.draw do
get "sessions/new"
resources :users
resources :sessions, :only => [ :new, :create, :destroy ]
resources :microposts, :only => [ :create, :destroy ]
get "pages/home"
root :to => 'pages#home'
match '/contact', :to => 'pages#contact'
match '/about', :to => 'pages#about'
match '/help', :to => 'pages#help'
match '/signup', :to => 'users#new'
match '/signin', :to => 'sessions#new'
match '/signout', :to => 'sessions#destroy'
end
In 11.26 the
createmethod is implemented. The action redirects to root on success or renders ‘pages/home’ on failure, so there should be no need for acreatetemplate. From my reading it looks like it’s saying the tests should pass after create is implemented, not before.