Skip to content

Commit

Permalink
Making sure that no arguments are being passed to the static methods
Browse files Browse the repository at this point in the history
  • Loading branch information
subnetmarco committed Mar 11, 2015
1 parent 3cc7c63 commit 1041afa
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions spec/classic_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,24 @@ describe("classic #classic", function()
local classOne = ClassOne("Mark")
local classTwo = ClassTwo("John")

assert.are.same("something better", classOne:getSomething())
assert.are.same("something", classTwo:getSomething())
spy.on(classOne, "getSomething")
spy.on(classTwo, "getSomething")

assert.are.same("something better", classOne.getSomething())
assert.are.same("something", classTwo.getSomething())

-- Make sure no arguments have been passed
assert.spy(classOne.getSomething).was_called_with()
assert.spy(classTwo.getSomething).was_called_with()

assert.are.same("something better", classOne.getSomething("hello"))
assert.spy(classOne.getSomething).was_called_with("hello")

-- Removing the spies
finally(function()
classOne.getSomething:revert()
classTwo.getSomething:revert()
end)
end)
it("Constructor returns error", function()
local status, res = pcall(ClassTwo, "wrong")
Expand Down

0 comments on commit 1041afa

Please sign in to comment.