From ffc34295e99b5c32229391e36f144afd39d0e67e Mon Sep 17 00:00:00 2001 From: Robin Malley Date: Sat, 11 Sep 2021 21:45:29 +0000 Subject: [PATCH] Add a log in the mock environment Add a function that implements `log()` in the mock environment. --- spec/env_mock.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/env_mock.lua b/spec/env_mock.lua index be1b67b..3777226 100644 --- a/spec/env_mock.lua +++ b/spec/env_mock.lua @@ -105,7 +105,7 @@ local smr_mock_env = { return req.cookies[cookie_name] end), http_response_cookie = spy.new(function(req,name,value) req.cookies = {[name] = value} end), - log = spy.new(function(priority, message) end), + log = spy.new(function(priority, message) --[[print(string.format("[LOG %q]: %s",priority,message))]] end), sha3 = spy.new(function(message) return "digest" end), } @@ -161,6 +161,7 @@ function mock.mockdb() local config = require("config") config.db = "data/unittest.db" assert(os.execute("rm " .. config.db)) + package.loaded.db = nil local db = require("db") end