[rspec-users] Problems with expect_render

Matt Patterson matt-lists at reprocessed.org
Tue Sep 25 11:57:10 EDT 2007

On 25 Sep 2007, at 16:06, David Chelimsky wrote:

> On 9/25/07, Matt Patterson <matt-lists at reprocessed.org> wrote:
>> Hi there,
>> I've been working with RSpec for about a week now, and the process of
>> moving from a Test::Unit + Mocha setup to an RSpec + Mocha
>> environment has been pretty straightforward.
>> Except, I'm having problems with using template.expect_render.
>> I have Mocha enabled with:
> It is not documented as such, but expect_render does not work with
> mocha. It uses rspec's underlying mock framework.

Yes, I knew about that, but the rdoc in lib/spec/rails/dsl/behaviour/ 
render_observer.rb made it sound like it should still work:

         # Also, +expect_render+ uses parts of RSpec's mock  
expectation framework. Because
         # it wraps only a subset of the framework, using this will  
create no conflict with
         # other mock frameworks if you choose to use them.  
Additionally, the object returned
         # by expect_render is an RSpec mock object, which means that  
you can call any of the
         # chained methods available in RSpec's mocks.

> Please feel free to submit a feature request for this.

I'd be happy to have a look and see whether I could patch it myself,  
but I've been having a few problems running all the specs cleanly.  
Currently rake pre_commit is bailing after the first spec run with  
complaints from rcov (both in 1.0.8 and trunk).

Can you give me some pointers on getting the tests to run cleanly?



   Matt Patterson | Design & Code
   <matt at reprocessed.org> | http://www.reprocessed.org/

More information about the rspec-users mailing list