This allows the call history for spies/stubs/mocks to be cleared without reverting the spy/stub/mock.
it("Makes sure call history for spy can be cleared", function()
local s = spy.new(function() return "foobar" end)
s()
s("test")
s:clear()
assert.spy(s).was_not.called()
assert.spy(s).was_not.returned_with("foobar")
end)
it("Makes sure call history for mocks can be cleared", function()
test.foo = { bar = function() return "foobar" end }
mock(test)
test.key()
test.key("test")
test.foo.bar()
test.foo.bar("hello world")
assert.spy(test.key).was.called()
assert.spy(test.foo.bar).was.called()
mock.clear(test)
assert.spy(test.key).was_not.called()
assert.spy(test.foo.bar).was_not.called()
end)
This allows the call history for spies/stubs/mocks to be cleared without reverting the spy/stub/mock.
Note: This is on top of PR #96