How do you constrain the allowable argument values passed to a method of a mock object in RSpec? (assuming an expectation has previously been set on that mock object)
For example, I want to do something like this:
@myMockObject.should_receive(:logValue).at_least(:once).with(anything(), should be > 0)
That is, I want to specify that @myMockObject receives a method call to logValue() with anything for the first argument and any integer greater than 0 for the second argument. Unfortunately, the above code does not work as written. Is there an easy way to do this?
1 Answer