[rspec-devel] [ rspec-Bugs-8914 ] [Controller] stubbed render_file on @template causes problems with rails -r6253

noreply at rubyforge.org noreply at rubyforge.org
Tue Feb 27 08:46:14 EST 2007


Bugs item #8914, was opened at 2007-02-27 10:54
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=8914&group_id=797

Category: rails plugin
Group: None
>Status: Closed
>Resolution: Out of Date
Priority: 3
Submitted By: Ian White (ianwhite)
Assigned to: David Chelimsky (dchelimsky)
Summary: [Controller] stubbed render_file on @template causes problems with rails -r6253

Initial Comment:
Since upgrading to r6253 of rails my controller specs are failing with the following problem:

  undefined method `size' for true:TrueClass

This is raised by the following method in (rails) action_controller/response.rb:72-74

  def set_content_length!
    self.headers["Content-Length"] = body.size unless body.respond_to?(:call)
  end

This is caused by line 47 in (rspec_on_rails) rails/context/controller.rb:47

  @template.stub!(:render_file).and_return(true)

response.body is set to true by render_file, which can't respond to size.

It's fixed for me by replacing line 47 with

  @template.stub!(:render_file).and_return("")

Cheers,
Ian White

----------------------------------------------------------------------

>Comment By: David Chelimsky (dchelimsky)
Date: 2007-02-27 13:46

Message:
Please include RSpec version numbers when submitting bug reports.

This is already fixed in 0.8.0-RC1, as we no longer stub #render_file.

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=8914&group_id=797


More information about the rspec-devel mailing list