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
brakeman-4.3.1 bundle/ruby/2.5.0/gems/haml-4.0.7/test/haml-spec/lua_haml_spec.lua
brakeman-4.3.0 bundle/ruby/2.5.0/gems/haml-4.0.7/test/haml-spec/lua_haml_spec.lua
brakeman-4.2.1 bundle/ruby/2.5.0/gems/haml-4.0.7/test/haml-spec/lua_haml_spec.lua
brakeman-4.2.0 bundle/ruby/2.3.0/gems/haml-4.0.7/test/haml-spec/lua_haml_spec.lua
brakeman-4.1.1 bundle/ruby/2.3.0/gems/haml-4.0.7/test/haml-spec/lua_haml_spec.lua
brakeman-4.1.0 bundle/ruby/2.3.0/gems/haml-4.0.7/test/haml-spec/lua_haml_spec.lua
brakeman-4.0.1 bundle/ruby/2.3.0/gems/haml-4.0.7/test/haml-spec/lua_haml_spec.lua
brakeman-4.0.1.pre1 bundle/ruby/2.3.0/gems/haml-4.0.7/test/haml-spec/lua_haml_spec.lua
brakeman-4.0.0 bundle/ruby/2.3.0/gems/haml-4.0.7/test/haml-spec/lua_haml_spec.lua
brakeman-3.7.2 bundle/ruby/2.3.0/gems/haml-4.0.7/test/haml-spec/lua_haml_spec.lua
brakeman-3.7.1 bundle/ruby/2.3.0/gems/haml-4.0.7/test/haml-spec/lua_haml_spec.lua
brakeman-3.7.0 bundle/ruby/2.3.0/gems/haml-4.0.7/test/haml-spec/lua_haml_spec.lua
brakeman-3.6.2 bundle/ruby/2.3.0/gems/haml-4.0.7/test/haml-spec/lua_haml_spec.lua
brakeman-3.6.1 bundle/ruby/2.3.0/gems/haml-4.0.7/test/haml-spec/lua_haml_spec.lua
brakeman-3.6.0 bundle/ruby/2.3.0/gems/haml-4.0.7/test/haml-spec/lua_haml_spec.lua
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/haml-4.0.7/test/haml-spec/lua_haml_spec.lua
brakeman-3.5.0 bundle/ruby/2.3.0/gems/haml-4.0.7/test/haml-spec/lua_haml_spec.lua
arcabouco-0.2.13 vendor/bundle/gems/haml-4.0.7/test/haml-spec/lua_haml_spec.lua
brakeman-3.4.1 bundle/ruby/2.3.0/gems/haml-4.0.7/test/haml-spec/lua_haml_spec.lua
brakeman-3.4.0 bundle/ruby/2.3.0/gems/haml-4.0.7/test/haml-spec/lua_haml_spec.lua