Introducing luaspec

I’ve been doing a lot of work with Lua over the past couple of years. Originally I used luaunit for unit testing. This has worked ok, but I’ve used RSpec while working with Ruby and have come to appreciate the specification style syntax and the different mindset it invokes while writing tests. So I introduce to you luaspec, a behaviour-driven design framework for Lua.

   1  require 'luaspec'
   2  
   3  describe["Account, withdrawing funds"] = function()
   4      before = function()
   5          account = Account:new { balance = 100 }
   6          account:withdraw(10)
   7      end
   8      
   9      it["should remove the withdrawal amount from the balance"] = function()
  10          expect(account.balance).should_be(90)
  11      end
  12  end

It supports nested contexts, before and after functions, and has built-in support for mocking. More articles coming in the upcoming days describing all the functionality fully.