class Post
def meth1; meth2; end
def meth2; nil; end
end
real_model = Post.new
mock_model = SomeMock.new real_model
mock_model.expect :meth1, true
mock_model.validate
mock_model.verify # should return true if #meth2 has worked and false
otherwise
Ryan, I didn’t understand you, sorry. I should validate if some method
has been called (maybe from another method). How can I do this?
I think I can create a boolean instance variable that is false at begin.
And redefine method I want to validate: it sets this variable to true.
Validate method returns this variable.
But are there some automated mechanisms/tools? Thanks.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.