[rspec-devel] [ rspec-Bugs-11143 ] Views code for ActionController::Base#render broke between 1.0.0 and 1.0.3 on Rails Edge r6731

noreply at rubyforge.org noreply at rubyforge.org
Sat May 26 14:23:51 EDT 2007


Bugs item #11143, was opened at 2007-05-26 07:53
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=11143&group_id=797

Category: rails plugin
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 3
Submitted By: Coda Hale (codahale)
Assigned to: David Chelimsky (dchelimsky)
Summary: Views code for ActionController::Base#render broke between 1.0.0 and 1.0.3 on Rails Edge r6731

Initial Comment:
I just updated to Rails r6731 and RSpec 1.0.3, and all my controller specs exploded:

1)
ActionView::ActionViewError in 'FavoritesController handling GET /user/1/favorites should be successful'
Couldn't find template file for favorites/index in ["/Users/coda/Project/app/views"]
/Users/coda/Project/vendor/plugins/rspec_on_rails/lib/spec/rails/dsl/behaviour/controller.rb:70:in `render'
/Users/coda/Project/app/controllers/favorites_controller.rb:10:in `index'
spec/controllers/favorites_controller_spec.rb:41:in `do_get'
spec/controllers/favorites_controller_spec.rb:45:
spec/controllers/favorites_controller_spec.rb:31:

The view is in app/views/favorites/index.html.erb, and the call to render it is just the default:

 respond_to do |format|
   format.html # index.html.erb
 end

The code works fine in development -- renders the right view and everything. This code used to pass with an older revision of Edge and RSpec 1.0.0, and I noticed that Spec::Rails::DSL::ControllerInstanceMethods#render has changed.

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

>Comment By: David Chelimsky (dchelimsky)
Date: 2007-05-26 18:23

Message:
Fixed in r2041.

The problem was two-fold. We recently removed the implicit re-raising (using rescue_action) of errors in controller examples to fix another bug. This had the unfortunate side effect of hiding errors. Additionally, there was a change in rails that caused rspec to fall down in controller examples with isolated views.

The rescue_action issue is now resolved by adding a method available in controller examples named "raise_controller_errors". This gets called from the generated spec_helper:

  config.before(:each, :behaviour_type => :controller) do
    raise_controller_errors
  end

The render problem is resolved by overriding render_file instead of render_template in Spec::Rails::DSL::ControllerInstanceMethods#render.

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

Comment By: David Chelimsky (dchelimsky)
Date: 2007-05-26 15:21

Message:
No - that was wrong. Working on it though.

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

Comment By: David Chelimsky (dchelimsky)
Date: 2007-05-26 15:01

Message:
Making some progress. I was able to duplicate this by defining rescue_action. It turns out that this is due to a change in rails, not the changes in RSpec. Spec::Rails::DSL::ControllerInstanceMethods#render is never being called in the example I've got failing!!!!

Still looking.

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

Comment By: David Chelimsky (dchelimsky)
Date: 2007-05-26 14:49

Message:
Coda, can you post the spec please? I'm not able to reproduce this error.

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

Comment By: Aslak Hellesøy (aslak_hellesoy)
Date: 2007-05-26 10:06

Message:
David, this is what I mentioned the other day. I haven't found a solution yet.

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

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


More information about the rspec-devel mailing list