RSpec controller testing: missing template on create

Viewed 8188

I have an interesting situation. I am testing the following simple create action:

# will only be accessed via Ajax 
def create
 click = Click.new(params[:click])
 click.save # don't really care whether its success or failure
end

Then I have the following very simple controller spec:

require 'spec_helper'

describe ClicksController, "creating a click" do
  it "should create a click for event" do
    xhr :post, :create, :click => {:event_id => 1}
    # more test to come...
  end
end

Seems trivial, yet I get the following:

Missing template clicks/create

Any tips would be appreciated.

4 Answers
Related