diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2018-04-06 09:02:31 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-04-11 14:38:06 -0300 |
commit | 43e656302c04caa8db429a204ba293ea3a8c5fac (patch) | |
tree | c214bb676e87d5dca4fb5985ac3a8120b3910fe7 /spec | |
parent | e91d86ed1e41724b857cc80b7f433926a319e2ef (diff) | |
download | luarocks-43e656302c04caa8db429a204ba293ea3a8c5fac.tar.gz luarocks-43e656302c04caa8db429a204ba293ea3a8c5fac.tar.bz2 luarocks-43e656302c04caa8db429a204ba293ea3a8c5fac.zip |
mock-server: make initialization independent of cwd
Diffstat (limited to 'spec')
-rw-r--r-- | spec/util/mock-server.lua | 2 | ||||
-rw-r--r-- | spec/util/test_env.lua | 3 |
2 files changed, 4 insertions, 1 deletions
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:[^/]+}", { | |||
70 | path = "/", | 70 | path = "/", |
71 | produces = "text/plain", | 71 | produces = "text/plain", |
72 | handler = function(query, name) | 72 | handler = function(query, name) |
73 | local basedir = arg[1] or "../spec/fixtures" | 73 | local basedir = arg[1] or "." |
74 | local fd = io.open(basedir .. "/" .. name, "r") | 74 | local fd = io.open(basedir .. "/" .. name, "r") |
75 | if not fd then | 75 | if not fd then |
76 | return restserver.response():status(404) | 76 | 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 | |||
759 | function test_env.mock_server_init() | 759 | function test_env.mock_server_init() |
760 | local testing_paths = test_env.testing_paths | 760 | local testing_paths = test_env.testing_paths |
761 | assert(test_env.need_rock("restserver-xavante")) | 761 | assert(test_env.need_rock("restserver-xavante")) |
762 | local pwd = lfs.currentdir() | ||
763 | lfs.chdir(testing_paths.fixtures_dir) | ||
762 | local final_command = test_env.execute_helper(testing_paths.lua .. " " .. testing_paths.util_dir .. "/mock-server.lua &", true, test_env.env_variables) | 764 | local final_command = test_env.execute_helper(testing_paths.lua .. " " .. testing_paths.util_dir .. "/mock-server.lua &", true, test_env.env_variables) |
763 | os.execute(final_command) | 765 | os.execute(final_command) |
766 | lfs.chdir(pwd) | ||
764 | end | 767 | end |
765 | 768 | ||
766 | function test_env.mock_server_done() | 769 | function test_env.mock_server_done() |