diff options
Diffstat (limited to 'spec/cmd_spec.lua')
-rw-r--r-- | spec/cmd_spec.lua | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/cmd_spec.lua b/spec/cmd_spec.lua new file mode 100644 index 00000000..70b9625d --- /dev/null +++ b/spec/cmd_spec.lua | |||
@@ -0,0 +1,34 @@ | |||
1 | local test_env = require("spec.util.test_env") | ||
2 | local run = test_env.run | ||
3 | |||
4 | test_env.unload_luarocks() | ||
5 | |||
6 | describe("LuaRocks command line #integration", function() | ||
7 | |||
8 | setup(function() | ||
9 | test_env.setup_specs() | ||
10 | end) | ||
11 | |||
12 | describe("--version", function() | ||
13 | it("returns the LuaRocks version", function() | ||
14 | local output = run.luarocks("--version") | ||
15 | assert.match("LuaRocks main command-line interface", output, 1, true) | ||
16 | end) | ||
17 | |||
18 | it("runs if Lua detection fails", function() | ||
19 | test_env.run_in_tmp(function(tmpdir) | ||
20 | test_env.write_file("bad_config.lua", [[ | ||
21 | variables = { | ||
22 | LUA_DIR = "/bad/lua/dir", | ||
23 | } | ||
24 | ]], finally) | ||
25 | local env = { | ||
26 | LUAROCKS_CONFIG = "bad_config.lua" | ||
27 | } | ||
28 | local output = run.luarocks("--version", env) | ||
29 | assert.match("LuaRocks main command-line interface", output, 1, true) | ||
30 | end, finally) | ||
31 | end) | ||
32 | end) | ||
33 | |||
34 | end) | ||