From b23ecc01544ff4c592c5f8912327b644043676ce Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Thu, 9 Nov 2017 02:59:51 -0200 Subject: Tests: mark new_version test using mock-server --- spec/new_version_spec.lua | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'spec') diff --git a/spec/new_version_spec.lua b/spec/new_version_spec.lua index 29449ff5..2f67141d 100644 --- a/spec/new_version_spec.lua +++ b/spec/new_version_spec.lua @@ -16,18 +16,18 @@ describe("LuaRocks new_version tests #blackbox #b_new_version", function() test_env.setup_specs(extra_rocks) end) - describe("LuaRocks new_version basic tests", function() - it("LuaRocks new version with no flags/arguments", function() + describe("basic tests", function() + it("with no flags/arguments", function() lfs.chdir("test") assert.is_false(run.luarocks_bool("new_version")) lfs.chdir(testing_paths.luarocks_dir) end) - it("LuaRocks new version invalid", function() + it("with invalid", function() assert.is_false(run.luarocks_bool("new_version invalid")) end) - it("LuaRocks new version invalid url", function() + it("with invalid url", function() assert.is_true(run.luarocks_bool("download --rockspec abelhas 1.0")) assert.is_true(run.luarocks_bool("new_version abelhas-1.0-1.rockspec 1.1 http://luainvalid")) assert.is.truthy(lfs.attributes("abelhas-1.1-1.rockspec")) @@ -35,41 +35,44 @@ describe("LuaRocks new_version tests #blackbox #b_new_version", function() end) end) - describe("LuaRocks new_version more complex tests", function() - it("LuaRocks new version with remote spec", function() - test_env.mock_server_init() - assert.is_true(run.luarocks_bool("new_version http://localhost:8080/file/a_rock-1.0-1.rockspec")) - assert.is.truthy(lfs.attributes("a_rock-1.0-1.rockspec")) - assert.is.truthy(lfs.attributes("a_rock-1.0-2.rockspec")) - test_env.remove_files(lfs.currentdir(), "luasocket--") - test_env.mock_server_done() - end) - - it("LuaRocks new_version of luacov", function() + describe("more complex tests", function() + it("of luacov", function() assert.is_true(run.luarocks_bool("download --rockspec luacov 0.11.0")) assert.is_true(run.luarocks_bool("new_version luacov-0.11.0-1.rockspec 0.2")) assert.is.truthy(lfs.attributes("luacov-0.2-1.rockspec")) test_env.remove_files(lfs.currentdir(), "luacov--") end) - it("LuaRocks new_version url of abelhas", function() + it("url of abelhas", function() assert.is_true(run.luarocks_bool("download --rockspec abelhas 1.0")) assert.is_true(run.luarocks_bool("new_version abelhas-1.0-1.rockspec 1.1 http://luaforge.net/frs/download.php/2658/abelhas-1.0.tar.gz")) assert.is.truthy(lfs.attributes("abelhas-1.1-1.rockspec")) test_env.remove_files(lfs.currentdir(), "abelhas--") end) - it("LuaRocks new_version of luacov with tag", function() + it("of luacov with tag", function() assert.is_true(run.luarocks_bool("download --rockspec luacov 0.11.0")) assert.is_true(run.luarocks_bool("new_version luacov-0.11.0-1.rockspec --tag v0.3")) assert.is.truthy(lfs.attributes("luacov-0.3-1.rockspec")) test_env.remove_files(lfs.currentdir(), "luacov--") end) - it("LuaRocks new version updating md5", function() + it("updating md5", function() assert.is_true(run.luarocks_bool("download --rockspec lpeg 0.12")) assert.is_true(run.luarocks_bool("new_version lpeg-0.12-1.rockspec 0.2 https://luarocks.org/manifests/gvvaughan/lpeg-1.0.0-1.rockspec")) test_env.remove_files(lfs.currentdir(), "lpeg--") end) end) + + describe("remote tests #mock", function() + it("with remote spec", function() + test_env.mock_server_init() + assert.is_true(run.luarocks_bool("new_version http://localhost:8080/file/a_rock-1.0-1.rockspec")) + assert.is.truthy(lfs.attributes("a_rock-1.0-1.rockspec")) + assert.is.truthy(lfs.attributes("a_rock-1.0-2.rockspec")) + test_env.remove_files(lfs.currentdir(), "luasocket--") + test_env.mock_server_done() + end) + end) + end) -- cgit v1.2.3-55-g6feb