diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2017-11-09 02:59:51 -0200 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2017-11-09 02:59:51 -0200 |
commit | b23ecc01544ff4c592c5f8912327b644043676ce (patch) | |
tree | 7e4c0ba993248e61bae699a520b5c9193c2dc9c5 /spec/new_version_spec.lua | |
parent | 9c7e9fed578b58fff14e7a3dd95bdad62ff6ab31 (diff) | |
download | luarocks-b23ecc01544ff4c592c5f8912327b644043676ce.tar.gz luarocks-b23ecc01544ff4c592c5f8912327b644043676ce.tar.bz2 luarocks-b23ecc01544ff4c592c5f8912327b644043676ce.zip |
Tests: mark new_version test using mock-server
Diffstat (limited to 'spec/new_version_spec.lua')
-rw-r--r-- | spec/new_version_spec.lua | 39 |
1 files changed, 21 insertions, 18 deletions
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() | |||
16 | test_env.setup_specs(extra_rocks) | 16 | test_env.setup_specs(extra_rocks) |
17 | end) | 17 | end) |
18 | 18 | ||
19 | describe("LuaRocks new_version basic tests", function() | 19 | describe("basic tests", function() |
20 | it("LuaRocks new version with no flags/arguments", function() | 20 | it("with no flags/arguments", function() |
21 | lfs.chdir("test") | 21 | lfs.chdir("test") |
22 | assert.is_false(run.luarocks_bool("new_version")) | 22 | assert.is_false(run.luarocks_bool("new_version")) |
23 | lfs.chdir(testing_paths.luarocks_dir) | 23 | lfs.chdir(testing_paths.luarocks_dir) |
24 | end) | 24 | end) |
25 | 25 | ||
26 | it("LuaRocks new version invalid", function() | 26 | it("with invalid", function() |
27 | assert.is_false(run.luarocks_bool("new_version invalid")) | 27 | assert.is_false(run.luarocks_bool("new_version invalid")) |
28 | end) | 28 | end) |
29 | 29 | ||
30 | it("LuaRocks new version invalid url", function() | 30 | it("with invalid url", function() |
31 | assert.is_true(run.luarocks_bool("download --rockspec abelhas 1.0")) | 31 | assert.is_true(run.luarocks_bool("download --rockspec abelhas 1.0")) |
32 | assert.is_true(run.luarocks_bool("new_version abelhas-1.0-1.rockspec 1.1 http://luainvalid")) | 32 | assert.is_true(run.luarocks_bool("new_version abelhas-1.0-1.rockspec 1.1 http://luainvalid")) |
33 | assert.is.truthy(lfs.attributes("abelhas-1.1-1.rockspec")) | 33 | assert.is.truthy(lfs.attributes("abelhas-1.1-1.rockspec")) |
@@ -35,41 +35,44 @@ describe("LuaRocks new_version tests #blackbox #b_new_version", function() | |||
35 | end) | 35 | end) |
36 | end) | 36 | end) |
37 | 37 | ||
38 | describe("LuaRocks new_version more complex tests", function() | 38 | describe("more complex tests", function() |
39 | it("LuaRocks new version with remote spec", function() | 39 | it("of luacov", function() |
40 | test_env.mock_server_init() | ||
41 | assert.is_true(run.luarocks_bool("new_version http://localhost:8080/file/a_rock-1.0-1.rockspec")) | ||
42 | assert.is.truthy(lfs.attributes("a_rock-1.0-1.rockspec")) | ||
43 | assert.is.truthy(lfs.attributes("a_rock-1.0-2.rockspec")) | ||
44 | test_env.remove_files(lfs.currentdir(), "luasocket--") | ||
45 | test_env.mock_server_done() | ||
46 | end) | ||
47 | |||
48 | it("LuaRocks new_version of luacov", function() | ||
49 | assert.is_true(run.luarocks_bool("download --rockspec luacov 0.11.0")) | 40 | assert.is_true(run.luarocks_bool("download --rockspec luacov 0.11.0")) |
50 | assert.is_true(run.luarocks_bool("new_version luacov-0.11.0-1.rockspec 0.2")) | 41 | assert.is_true(run.luarocks_bool("new_version luacov-0.11.0-1.rockspec 0.2")) |
51 | assert.is.truthy(lfs.attributes("luacov-0.2-1.rockspec")) | 42 | assert.is.truthy(lfs.attributes("luacov-0.2-1.rockspec")) |
52 | test_env.remove_files(lfs.currentdir(), "luacov--") | 43 | test_env.remove_files(lfs.currentdir(), "luacov--") |
53 | end) | 44 | end) |
54 | 45 | ||
55 | it("LuaRocks new_version url of abelhas", function() | 46 | it("url of abelhas", function() |
56 | assert.is_true(run.luarocks_bool("download --rockspec abelhas 1.0")) | 47 | assert.is_true(run.luarocks_bool("download --rockspec abelhas 1.0")) |
57 | 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")) | 48 | 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")) |
58 | assert.is.truthy(lfs.attributes("abelhas-1.1-1.rockspec")) | 49 | assert.is.truthy(lfs.attributes("abelhas-1.1-1.rockspec")) |
59 | test_env.remove_files(lfs.currentdir(), "abelhas--") | 50 | test_env.remove_files(lfs.currentdir(), "abelhas--") |
60 | end) | 51 | end) |
61 | 52 | ||
62 | it("LuaRocks new_version of luacov with tag", function() | 53 | it("of luacov with tag", function() |
63 | assert.is_true(run.luarocks_bool("download --rockspec luacov 0.11.0")) | 54 | assert.is_true(run.luarocks_bool("download --rockspec luacov 0.11.0")) |
64 | assert.is_true(run.luarocks_bool("new_version luacov-0.11.0-1.rockspec --tag v0.3")) | 55 | assert.is_true(run.luarocks_bool("new_version luacov-0.11.0-1.rockspec --tag v0.3")) |
65 | assert.is.truthy(lfs.attributes("luacov-0.3-1.rockspec")) | 56 | assert.is.truthy(lfs.attributes("luacov-0.3-1.rockspec")) |
66 | test_env.remove_files(lfs.currentdir(), "luacov--") | 57 | test_env.remove_files(lfs.currentdir(), "luacov--") |
67 | end) | 58 | end) |
68 | 59 | ||
69 | it("LuaRocks new version updating md5", function() | 60 | it("updating md5", function() |
70 | assert.is_true(run.luarocks_bool("download --rockspec lpeg 0.12")) | 61 | assert.is_true(run.luarocks_bool("download --rockspec lpeg 0.12")) |
71 | 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")) | 62 | 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")) |
72 | test_env.remove_files(lfs.currentdir(), "lpeg--") | 63 | test_env.remove_files(lfs.currentdir(), "lpeg--") |
73 | end) | 64 | end) |
74 | end) | 65 | end) |
66 | |||
67 | describe("remote tests #mock", function() | ||
68 | it("with remote spec", function() | ||
69 | test_env.mock_server_init() | ||
70 | assert.is_true(run.luarocks_bool("new_version http://localhost:8080/file/a_rock-1.0-1.rockspec")) | ||
71 | assert.is.truthy(lfs.attributes("a_rock-1.0-1.rockspec")) | ||
72 | assert.is.truthy(lfs.attributes("a_rock-1.0-2.rockspec")) | ||
73 | test_env.remove_files(lfs.currentdir(), "luasocket--") | ||
74 | test_env.mock_server_done() | ||
75 | end) | ||
76 | end) | ||
77 | |||
75 | end) | 78 | end) |