From 43e656302c04caa8db429a204ba293ea3a8c5fac Mon Sep 17 00:00:00 2001
From: Hisham Muhammad <hisham@gobolinux.org>
Date: Fri, 6 Apr 2018 09:02:31 -0300
Subject: mock-server: make initialization independent of cwd

---
 spec/util/mock-server.lua | 2 +-
 spec/util/test_env.lua    | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

(limited to 'spec')

diff --git a/spec/util/mock-server.lua b/spec/util/mock-server.lua
index 30586c98..9b510d3b 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 "../spec/fixtures"
+         local basedir = arg[1] or "."
          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 0ddcfe43..fbb46d82 100644
--- a/spec/util/test_env.lua
+++ b/spec/util/test_env.lua
@@ -759,8 +759,11 @@ 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)
    os.execute(final_command)
+   lfs.chdir(pwd)
 end
 
 function test_env.mock_server_done()
-- 
cgit v1.2.3-55-g6feb