in Projects, Programming, Technology

Q: How do you stub a method call for a rails unit test such that it returns a…

Q: How do you stub a method call for a rails unit test such that it returns a different value the second time it is called?

A:  stubs(:foo).returns(1,2)
returns 1 the first call, 2 the second, etc.

Write a Comment

Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.