#--- # Excerpted from "The RSpec Book", # published by The Pragmatic Bookshelf. # Copyrights apply to this code. It may not be used to create training material, # courses, books, articles, and the like. Contact us if you are in doubt. # We make no guarantees that this code is fit for any purpose. # Visit http://www.pragmaticprogrammer.com/titles/achbd for more book information. #--- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe "messages/edit.html.erb" do before(:each) do @message = mock_model(Message, :null_object => true) assigns[:message] = @message end it_should_behave_like "a template that renders the messages/form partial" it "should render the messages/form" do template.should_receive(:render).with( :partial => "form", :locals => { :message => @message } ).and_return "rendered form partial" render "messages/edit.html.erb" response.should contain("rendered form partial") end end