aboutsummaryrefslogtreecommitdiff
path: root/spec/cmd_spec.lua
blob: 70b9625d16eed28a49a79d037582c911506f31ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
local test_env = require("spec.util.test_env")
local run = test_env.run

test_env.unload_luarocks()

describe("LuaRocks command line #integration", function()
   
   setup(function()
      test_env.setup_specs()
   end)

   describe("--version", function()
      it("returns the LuaRocks version", function()
         local output = run.luarocks("--version")
         assert.match("LuaRocks main command-line interface", output, 1, true)
      end)

      it("runs if Lua detection fails", function()
         test_env.run_in_tmp(function(tmpdir)
            test_env.write_file("bad_config.lua", [[
               variables = {
                  LUA_DIR = "/bad/lua/dir",
               }
            ]], finally)
            local env = {
               LUAROCKS_CONFIG = "bad_config.lua"
            }
            local output = run.luarocks("--version", env)
            assert.match("LuaRocks main command-line interface", output, 1, true)
         end, finally)
      end)
   end)

end)