rspec testing ajax response (should render a partial)

I want to test that my controller action is rendering a partial.

I've poked around and I can't seem to find anything that works.

create action:

def create
  @project = Project.new...
  respond_to do |format|
    if @project.save
      format.js { render :partial => "projects/form" }
    end
  end
end

spec:

it "should save and render partial" do
  ....
  #I expected/hoped this would work
  response.should render_partial("projects/form")
  #or even hopefully
  response.should render_template("projects/form")
  #no dice
end
8
задан zishe 28 May 2014 в 09:07
поделиться