ruby on rails - Changing mocha default expects exactly once -


I have started using MOCHA now and I am worried that when creating a new fake item, This is called once. My helpful ways to generate my mask and I am doing something like this

  my_mock = mock  

all parameters can not be found Each exam is called for the method so it will increase an error:

Expected one time, not yet applicable

So I thought I need to do something like this:

  my_mock = fake () HashOfParameters.each do | K, v | My_mock.expects (k) Returns (v) .at_least (0) end  

This works, but I was thinking that there was an easy way to do this, like changing a default configuration ... < / P>

OK, this was a stupid question ... I did not take the time to actually get a fake and a Understand the difference between Stub It is a good article that shows how it works:

So in my example, I used the stub method instead of mock Karan Should.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -