class methods and attributes work. Object spec is nearly finished

This commit is contained in:
Enrique García Cota 2011-08-09 00:06:05 +02:00
parent 0e637ea8da
commit 02f5f05b6a

View File

@ -161,18 +161,16 @@ context('An instance method', function()
end)
context('A class attribute', function()
local A, B
--[[
before(function()
A = class('A')
A.static.foo = 'foo'
context('A class attribute', function()
local A = class('A')
A.foo = 'foo'
local B = class('B', A)
B = class('B', A)
end)
test('should be available after being initialized', function()
assert_equal(A.foo, 'foo')
@ -187,13 +185,19 @@ end)
assert_equal(B.foo, 'chunky bacon')
assert_equal(A.foo, 'foo')
end)
end)
context('A class method', function()
local A = class('A')
end)
context('A class method', function()
local A, B
before(function()
A = class('A')
function A.foo(theClass) return 'foo' end
local B = class('B', A)
B = class('B', A)
end)
test('should be available after being initialized', function()
assert_equal(A:foo(), 'foo')
@ -208,8 +212,10 @@ end)
assert_equal(B:foo(), 'chunky bacon')
assert_equal(A:foo(), 'foo')
end)
end)
end)
--[[
context('A Mixin', function()
local Class1 = class('Class1')