[rspec-users] Does mock_model's :null_object option work?

David Chelimsky dchelimsky at gmail.com
Wed Dec 5 10:02:13 EST 2007


On Dec 5, 2007 8:52 AM, Al Chou <hotfusionman at yahoo.com> wrote:
>
> Please understand in the following that I am making relatively minor changes
> to legacy (non-TDD/BDD) code in Substruct and don't have the time to
> refactor nicely right now.  I'm just trying to get past the
> untested/un-speced cruft quickly to write the spec for my new code, so I'm
> looking for expediency over prettiness.
>
> I'm specifying
>
> before( :each ) do
>   @order_address = mock_model( OrderAddress, :null_object => TRUE )

:null_object => true (lower case) should work.

> end
>
> but finding that unstubbed/unmocked method calls on @order_address still
> throw error messages like:
>
> Mock 'OrderAddress_1026' received unexpected message :first_name with (no
> args)
>
> so I'm starting to wonder whether the :null_object option is doing anything
> at all....
>
>
> Al
>
>  ________________________________
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it
> now.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list