erlangeunitmeck

Using meck to make multiple calls to the same method with the same arguments


I know that with ruby/rspec, you can do something like the following in order to receive different return values for the different calls made to the method:

allow(double).to receive(:msg).and_return(value1, value2, value3)

I've only been able to make meck stub a method with one return value like so:

meck:expect(module, some_method, fun() -> ok end)

Is there a way to make it return ok on the first call and then ok2 on the second?


Solution

  • To do this, there are two shortcuts in Meck you can use: