The helper spec I am writing tests a helper method that calls render. ## module HelperHelper def render_partial render :partial => 'partial' end end ##
The helper spec. ## describe HelperHelper do it "should render partial" do render_partial.should_not == nil end end ## The output generated ## $ spec spec/helpers/home_helper_spec.rb .F 1) NoMethodError in 'HelperHelper should render partial' You have a nil object when you didn't expect it! The error occurred while evaluating nil.render app/helpers/helper_helper.rb:4:in `render_partial' ./spec/helpers/helper_helper_spec.rb:3: Finished in 0.00000 seconds 1 example, 1 failure ## I tried adding a before(:each) to setup response, controller, and template objects that render would be called on but the error was always the same. I am still uncertain I did this correctly although I did spend some time looking at the render definition in the rails source. Is there a standard way of setting up specs for helpers that call render? - Peter (I apologize if this has already been answered. We spent a good deal of time searching around the web for a solution but came up empty so far.) _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users