Hi Xavier
Thanks for your reply.
I want assert whether `calculate` has been called no. of times that loop has been iterated with the same parameters every time.
And on class `InterestAmount` initializer I set the parameters in instance variables like as follows so that I can use same instance variables across all methods in `InterestAmount` class.
class InterestAmount
def initialize(installment, date, project)
@installment = installment
@project = project
@date = date
end
end
To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/444f7e07-369b-47bb-a920-5fce1a282907%40googlegroups.com.
You can stub any arbitrary chain of methods by setting up the stubs individually:allow(a).to receive(:foo).with(1).and_return(b = double)allow(b).to receive(:bar).with(2).and_return(c = double)allow(c).to receive(:baz).with(3).and_return("it worked")expect(a.foo(1).bar(2).baz(3)).to eq("it worked")HTH,Myron