This is matchers for render(:nothing => true).
Add some code into spec/spec_helper.rb is as follows:
# Matchers for render(:nothing => true)
class RenderNothing
def initialize
end
def matches?(controller)
@actual = controller.rendered_file
@actual == nil
end
def failure_message
return "render_nothing expected (render :nothing => true), got #{@actual.inspect}"
end
def negative_failure_message
return "render_nothing expected (render :nothing => true) not to equal #{@actual.inspect}"
end
end
def render_nothing
RenderNothing.new
end
Use render_nothing.
it "should not render anything" do
post :destroy, :id => 1
response.should render_nothing
end