mirror of
https://github.com/kikito/beholder.lua.git
synced 2024-12-16 00:34:21 +00:00
30 lines
460 B
Lua
30 lines
460 B
Lua
|
local beholder = require 'beholder'
|
||
|
|
||
|
|
||
|
describe("Acceptance", function()
|
||
|
|
||
|
before(function()
|
||
|
beholder:reset()
|
||
|
end)
|
||
|
|
||
|
test("Normal behavior", function()
|
||
|
|
||
|
local counter = 0
|
||
|
|
||
|
local id = beholder:observe("EVENT", function() counter = counter + 1 end)
|
||
|
|
||
|
beholder:trigger("EVENT")
|
||
|
beholder:trigger("EVENT")
|
||
|
|
||
|
assert_equal(counter, 2)
|
||
|
|
||
|
beholder:stopObserving(id)
|
||
|
|
||
|
beholder:trigger("EVENT")
|
||
|
|
||
|
assert_equal(counter, 2)
|
||
|
|
||
|
end)
|
||
|
|
||
|
end)
|