From 1dcdaa77c0a52ad02f49bc7fdde2fd7dee956ddf Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Mon, 7 May 2018 11:22:07 -0300 Subject: Tests: test the "busted" backend of `luarocks test` with a local fixture --- spec/util/mock-server.lua | 2 +- spec/util/test_env.lua | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'spec/util') diff --git a/spec/util/mock-server.lua b/spec/util/mock-server.lua index 9b510d3b..ae41b964 100644 --- a/spec/util/mock-server.lua +++ b/spec/util/mock-server.lua @@ -70,7 +70,7 @@ server:add_resource("/file/{name:[^/]+}", { path = "/", produces = "text/plain", handler = function(query, name) - local basedir = arg[1] or "." + local basedir = arg[1] or "./spec/fixtures" local fd = io.open(basedir .. "/" .. name, "r") if not fd then return restserver.response():status(404) diff --git a/spec/util/test_env.lua b/spec/util/test_env.lua index 7b5b66b9..f55fb53a 100644 --- a/spec/util/test_env.lua +++ b/spec/util/test_env.lua @@ -506,6 +506,7 @@ local function create_paths(luaversion_full) end testing_paths.fixtures_dir = base_dir .. "/spec/fixtures" + testing_paths.fixtures_repo_dir = base_dir .. "/spec/fixtures/a_repo" testing_paths.util_dir = base_dir .. "/spec/util" testing_paths.testrun_dir = base_dir .. "/testrun" testing_paths.src_dir = base_dir .. "/src" @@ -763,12 +764,9 @@ end function test_env.mock_server_init() local testing_paths = test_env.testing_paths assert(test_env.need_rock("restserver-xavante")) - local pwd = lfs.currentdir() - lfs.chdir(testing_paths.fixtures_dir) - local final_command = test_env.execute_helper(testing_paths.lua .. " " .. testing_paths.util_dir .. "/mock-server.lua &", true, test_env.env_variables) + local final_command = test_env.execute_helper(testing_paths.lua .. " " .. testing_paths.util_dir .. "/mock-server.lua " .. testing_paths.fixtures_dir .. " &", true, test_env.env_variables) os.execute(final_command) os.execute("sleep 1") - lfs.chdir(pwd) end function test_env.mock_server_done() -- cgit v1.2.3-55-g6feb