# HG changeset patch # User Kim Alvefur # Date 1586620779 -7200 # Node ID ad86b93093a30109181430e8a5c9244884ef63da # Parent 9ecad23042977a42855e71c2718f93a3fb7cade6 spec: Include a hacky moduleapi stub to allow test to proceed diff -r 9ecad2304297 -r ad86b93093a3 spec/muc_util_spec.lua --- a/spec/muc_util_spec.lua Sat Apr 11 16:45:27 2020 +0100 +++ b/spec/muc_util_spec.lua Sat Apr 11 17:59:39 2020 +0200 @@ -3,11 +3,23 @@ local st = require "util.stanza"; do - local old_pp = package.path; - package.path = "./?.lib.lua;"..package.path; - muc_util = require "plugins.muc.util"; - package.path = old_pp; -end + -- XXX Hack for lack of a mock moduleapi + local env = setmetatable({ + module = { + _shared = {}; + -- Close enough to the real module:shared() for our purposes here + shared = function (self, name) + local t = self._shared[name]; + if t == nil then + t = {}; + self._shared[name] = t; + end + return t; + end; + } + }, { __index = _ENV or _G }); + muc_util = require "util.envload".envloadfile("plugins/muc/util.lib.lua", env)(); + end describe("muc/util", function () describe("filter_muc_x()", function ()