Hi, I'm trying to spec a controller method which renders some rjs as part of a render :update block. The problem I'm having is that stub_render or expect_render don't seem to allow and_return to work.
The controller method does: if @thing.save render :update do |page| page.insert_html :bottom, 'x_thing_list', :partial => 'thing', :object => @thing page.form.reset 'x_new_thing' end else If I expect/stub_render the partial render (which I need to do if I want to solely test the controller in isolation), I get: new Insertion.Bottom("x_thing_list", null); Form.reset("x_new_thing"); The null is due to the render :partial being stubbed. Unfortunately, this breaks the regex that assert_rjs uses, so my test: response.should have_rjs(:insert, :bottom, "x_thing_list") fails, when it should pass. What I need to be able to do is: expect_render(:partial => 'thing', :object => @thing).and_return('"x"') so that the output satisfies the assert_rjs regex. I would love to provide a patch for this, but I cannot see why it doesn't already work. The expect_render return value seems to be a normal mock, I don't understand why return values aren't working in this case. Thanks for any insights. _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users