Skip to content

Commit

Permalink
Add a unit test for disabling and re-enabling actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric James Michael Ritz committed Sep 3, 2013
1 parent ddc4a2e commit f9e7126
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/Luvent.spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,29 @@ describe("Basic action management", function ()

end)

describe("Disabling and re-enabling actions", function ()

it("Does not invoke disabled actions", function ()
local echo = spy.new(echo)
local noop = spy.new(noop)

event:addAction(echo)
event:addAction(noop)
event:disableAction(echo)
event:trigger()

assert.spy(echo).was_not_called()
assert.spy(noop).was_called(1)

event:enableAction(echo)
event:trigger()

assert.spy(echo).was_called(1)
assert.spy(noop).was_called(2)
end)

end)

end)

describe("Triggering events", function ()
Expand Down

0 comments on commit f9e7126

Please sign in to comment.