Sha256: 35e26be56a3a381fdfe534973a6502d9221e0196498a873e99ab21fcbd4521a1

Contents?: true

Size: 1.07 KB

Versions: 88

Compression:

Stored size: 1.07 KB

Contents

local dir       = require 'pl.dir'
local haml      = require 'haml'
local json      = require 'json'
local path      = require 'pl.path'
local telescope = require 'telescope'
local assert    = assert
local describe  = telescope.describe
local getinfo   = debug.getinfo
local it        = telescope.it
local open      = io.open
local pairs     = pairs

module('hamlspec')

local function get_tests(filename)
  local me = path.abspath(getinfo(1).source:match("@(.*)$"))
  return path.join(path.dirname(me), filename)
end

local json_file = get_tests("tests.json")
local file      = assert(open(json_file))
local input     = file:read '*a'
file:close()

local contexts = json.decode(input)

describe("LuaHaml", function()
   for context, expectations in pairs(contexts) do
     describe("When handling " .. context, function()
      for name, exp in pairs(expectations) do
        it(("should correctly render %s"):format(name), function()
          local engine = haml.new(exp.config)
          assert_equal(engine:render(exp.haml, exp.locals), exp.html)
        end)
      end
     end)
   end
end)

Version data entries

88 entries across 88 versions & 9 rubygems

Version Path
classiccms-0.6.7 vendor/bundle/gems/haml-3.1.5/test/haml-spec/lua_haml_spec.lua
classiccms-0.6.6 vendor/bundle/gems/haml-3.1.5/test/haml-spec/lua_haml_spec.lua
classiccms-0.6.5 vendor/bundle/gems/haml-3.1.5/test/haml-spec/lua_haml_spec.lua
classiccms-0.6.4 vendor/bundle/gems/haml-3.1.5/test/haml-spec/lua_haml_spec.lua
classiccms-0.6.3 vendor/bundle/gems/haml-3.1.5/test/haml-spec/lua_haml_spec.lua
classiccms-0.6.2 vendor/bundle/gems/haml-3.1.5/test/haml-spec/lua_haml_spec.lua
haml-3.2.0.rc.1 test/haml-spec/lua_haml_spec.lua
classiccms-0.6.1 vendor/bundle/gems/haml-3.1.5/test/haml-spec/lua_haml_spec.lua
classiccms-0.6.0 vendor/bundle/gems/haml-3.1.5/test/haml-spec/lua_haml_spec.lua
classiccms-0.5.17 vendor/bundle/gems/haml-3.1.5/test/haml-spec/lua_haml_spec.lua
classiccms-0.5.16 vendor/bundle/gems/haml-3.1.5/test/haml-spec/lua_haml_spec.lua
classiccms-0.5.15 vendor/bundle/gems/haml-3.1.5/test/haml-spec/lua_haml_spec.lua
classiccms-0.5.14 vendor/bundle/gems/haml-3.1.5/test/haml-spec/lua_haml_spec.lua
classiccms-0.5.13 vendor/bundle/gems/haml-3.1.5/test/haml-spec/lua_haml_spec.lua
classiccms-0.5.12 vendor/bundle/gems/haml-3.1.5/test/haml-spec/lua_haml_spec.lua
classiccms-0.5.11 vendor/bundle/gems/haml-3.1.5/test/haml-spec/lua_haml_spec.lua
classiccms-0.5.10 vendor/bundle/gems/haml-3.1.5/test/haml-spec/lua_haml_spec.lua
classiccms-0.5.9 vendor/bundle/gems/haml-3.1.5/test/haml-spec/lua_haml_spec.lua
haml-3.2.0.beta.3 test/haml-spec/lua_haml_spec.lua
classiccms-0.5.8 vendor/bundle/gems/haml-3.1.5/test/haml-spec/lua_haml_spec.lua