Hi On 26 September 2012 16:16, deepak kannan <kannan.dee...@gmail.com> wrote:
> hi, > > Problem is that i want to test chained method calls. Where the method > chain is optional > But if the method chain is called then certain assertions apply on the > method chain itself > > The object may or may not call a method. > But if it does call the method then it has to call another method on it > (ie. method chain) with certain arguments > I wrote a comment explaining my actual usecase at > https://github.com/rspec/rspec-mocks/issues/133#issuecomment-8886264 > > kind-of obfuscated and simplified code example is at > https://gist.github.com/3788035 > > code snippet: > mock = mock('Monitor') > mock.should_receive(:ping).with('DS1').and_return(stub.as_null_object) > devops.should_receive(:monitor).and_return(proxy) > > i read these issues > https://github.com/rspec/rspec-mocks/issues/131 > https://github.com/rspec/rspec-mocks/issues/133 > > -- > best, > deepak > w: https://gist.github.com/deepak > Did you read the discussion from the issue? https://github.com/rspec/rspec-mocks/issues/133 It makes a strong case as to why at_least(0) makes no sense. Cheers, Ben
_______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users