I want to put the common controller actions, index, show, create etc. in the ApplicationController like this:
class ApplicationController < ActionController::Base
respond_to :json
def index
#implementation
end
def show
#implementation
end
def update
#implementation
end
end
The app will only return JSON.
I have written the following spec to test this with RSPEC's annonymous controller
describe ApplicationController do
controller do ; end
describe 'Get :index' do
it 'should respond to index' do
get :index
response.code.should eq "200"
end
end
end
The above spec gives the following error:
ActionView::MissingTemplate: Missing template anonymous/index, application/index with {:locale=>[:en], :formats=>[:json], :handlers=>[:erb, :builder]}. Searched in: * "#"
Can anyone suggest a way to make this work with the anonymous controller?
xhr :get :indexinstead ofget :indexhelp? - Sam Peacey