From 121ba1ace77b0dbe4b35d25fcb88ece8606ec685 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Sun, 1 Jul 2018 21:28:36 -0300 Subject: Tests: improve isolation of tests --- spec/util/test_env.lua | 1 + spec/write_rockspec_spec.lua | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/spec/util/test_env.lua b/spec/util/test_env.lua index 60162ee3..51893e83 100644 --- a/spec/util/test_env.lua +++ b/spec/util/test_env.lua @@ -120,6 +120,7 @@ function test_env.execute_helper(command, print_command, env_variables) "LUA_CPATH_5_2", "LUA_PATH_5_3", "LUA_CPATH_5_3", + "LUAROCKS_SYSCONFDIR", } if env_variables then diff --git a/spec/write_rockspec_spec.lua b/spec/write_rockspec_spec.lua index 295eaa6b..1fb53547 100644 --- a/spec/write_rockspec_spec.lua +++ b/spec/write_rockspec_spec.lua @@ -9,16 +9,6 @@ describe("LuaRocks write_rockspec tests #integration", function() test_env.setup_specs() end) - it("runs with no flags/arguments", function() - local d = lfs.currentdir() - finally(function() - os.remove("testrock-dev-1.rockspec") - lfs.chdir(d) - end) - lfs.chdir("..") - assert.is_true(run.luarocks_bool("write_rockspec")) - end) - it("fails with invalid argument", function() assert.is_false(run.luarocks_bool("write_rockspec invalid")) end) @@ -38,6 +28,19 @@ describe("LuaRocks write_rockspec tests #integration", function() git:stop() end) + it("runs with no flags/arguments", function() + local d = lfs.currentdir() + finally(function() + os.remove("testrock-dev-1.rockspec") + lfs.chdir(d) + test_env.remove_dir("testrock") + end) + os.execute("git clone git://localhost/testrock") + lfs.chdir("testrock") + assert.is_true(run.luarocks_bool("write_rockspec")) + assert.is.truthy(lfs.attributes("testrock-dev-1.rockspec")) + end) + it("runs", function() finally(function() os.remove("testrock-dev-1.rockspec") end) assert.is_true(run.luarocks_bool("write_rockspec git://localhost/testrock")) -- cgit v1.2.3-55-g6feb