I would like to ask for Your experience how to handle mocking class
method only for one specific test.
Scenario is:
I have unit test suite and in one of the test I have mocked a class
method, and I want this class method to be only mocked in this
specific test.
But this mock applies to all test files while I run rake test:units.
I thought about doing like this with setup and teardown:
class SomeTest < …
def setup
#here ovveride class method body in runtime
end
def teardown
#and here bring back class method body in runtime
end
end
But I’m not sure if this is the way it should be done ?
And the reason why I need to do it this way is because in some
particular tests I need to mock the class method and in other i don’t.
In my case it is about calls to sandbox. In some tests I check if they
are made correctly and in other I test only logic flow and I don’t
want to make real calls to sandbox.
Thanks for any ideas.