[rspec-users] Testing initialize methods and chained methods
apremdas at gmail.com
Tue Oct 19 13:12:08 EDT 2010
Set an expectation that do_something should be called once. Then create a
With the method chain set an expectation that your chained method should be
called, then call the original method. You should be able to check that the
original method is passed as a param.
Further information in RSpec book which has some gr8 stuff on expectations
On 19 October 2010 08:56, Oscar Del Ben <thehcdreamer at gmail.com> wrote:
> I'm having some troubles understanding how to test a couple of things.
> Usually, if I'm having trouble testing something, it means that my design
> could probably be improved or changed, but in these cases I think I'm doing
> the right thing.
> Here's the first scenario:
> class Foo
> def initialize
> Here I have no idea how to test that the do_something method is called.
> Another issue I have is with the following code:
> Here I'm having trouble understanding how to test that my_method receives
> another_chained_method and so on.
> Any help would be very appreciated. Thanks!
> rspec-users mailing list
> rspec-users at rubyforge.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rspec-users