diff options
| author | Mike Vink <mike@pionative.com> | 2025-02-03 21:29:42 +0100 |
|---|---|---|
| committer | Mike Vink <mike@pionative.com> | 2025-02-03 21:29:42 +0100 |
| commit | 5155816b7b925dec5d5feb1568b1d7ceb00938b9 (patch) | |
| tree | deca28ea15e79f6f804c3d90d2ba757881638af5 /spec/download_spec.lua | |
Diffstat (limited to 'spec/download_spec.lua')
| -rw-r--r-- | spec/download_spec.lua | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/spec/download_spec.lua b/spec/download_spec.lua new file mode 100644 index 0000000..f7c10e8 --- /dev/null +++ b/spec/download_spec.lua @@ -0,0 +1,55 @@ +local test_env = require("spec.util.test_env") +local lfs = require("lfs") +local run = test_env.run +local testing_paths = test_env.testing_paths + +local extra_rocks = { + "/say-1.3-1.rockspec", +} + +describe("luarocks download #integration", function() + + before_each(function() + test_env.setup_specs(extra_rocks) + end) + + it("with no flags/arguments", function() + assert.is_false(run.luarocks_bool("download")) + end) + + it("invalid", function() + assert.is_false(run.luarocks_bool("download invalid")) + end) + + it("all with delete downloaded files", function() --TODO maybe download --all more rocks + assert.is_true(run.luarocks_bool("download --all say")) + assert.is.truthy(lfs.attributes("say-1.3-1.rockspec")) + test_env.remove_files(lfs.currentdir(), "say--") + end) + + it("rockspec version", function() + assert.is_true(run.luarocks_bool("download --rockspec say 1.3-1")) + assert.is.truthy(lfs.attributes("say-1.3-1.rockspec")) + test_env.remove_files(lfs.currentdir(), "say--") + end) + + describe("#namespaces", function() + it("retrieves namespaced rockspec", function() + finally(function() + os.remove("a_rock-2.0-1.rockspec") + end) + assert(run.luarocks_bool("download a_user/a_rock --rockspec --server=" .. testing_paths.fixtures_dir .. "/a_repo" )) + assert(lfs.attributes("a_rock-2.0-1.rockspec")) + end) + + it("retrieves namespaced rock", function() + finally(function() + os.remove("a_rock-2.0-1.src.rock") + end) + assert(run.luarocks_bool("download a_user/a_rock --server=" .. testing_paths.fixtures_dir .. "/a_repo" )) + assert(lfs.attributes("a_rock-2.0-1.src.rock")) + end) + end) + + +end) |
