aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-04-11 17:59:39 +0200
committerKim Alvefur <zash@zash.se>2020-04-11 17:59:39 +0200
commit1f92aa928062b406778e78ab9c1030b8d6be5bed (patch)
treeab3a91c278bb86e37a34e670e75830c9155801bd /spec
parent9a93e48a90837674d400f915722a9335751e7d07 (diff)
downloadprosody-1f92aa928062b406778e78ab9c1030b8d6be5bed.tar.gz
prosody-1f92aa928062b406778e78ab9c1030b8d6be5bed.zip
spec: Include a hacky moduleapi stub to allow test to proceed
Diffstat (limited to 'spec')
-rw-r--r--spec/muc_util_spec.lua22
1 files changed, 17 insertions, 5 deletions
diff --git a/spec/muc_util_spec.lua b/spec/muc_util_spec.lua
index cef68e80..3b2da4d0 100644
--- a/spec/muc_util_spec.lua
+++ b/spec/muc_util_spec.lua
@@ -3,11 +3,23 @@ local muc_util;
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 ()