diff --git a/tests/main.cr b/tests/main.cr index 9851fd4..c3c2a57 100644 --- a/tests/main.cr +++ b/tests/main.cr @@ -1,5 +1,5 @@ require "spec" -require "./spec_helper" +require "./methods/*" check_top_level_imports("modules") check_top_level_imports("overlays") diff --git a/tests/methods/check_latest_commit.cr b/tests/methods/check_latest_commit.cr new file mode 100644 index 0000000..fb21d76 --- /dev/null +++ b/tests/methods/check_latest_commit.cr @@ -0,0 +1,16 @@ +require "spec" +require "json" +require "http/client" + +def check_latest_commit(repository, branch = "master") + response = HTTP::Client.get "https://api.github.com/repos/#{repository}/branches/#{branch}" + response.status_code.should eq(200) + json = JSON.parse(response.body) + + File.read_lines("./overlays/#{repository.split("/")[1]}/default.nix").each do |line| + if line.includes? "version =" + nix_hash = line.split('"')[1] + json["commit"]["sha"].should eq(nix_hash) + end + end +end diff --git a/tests/spec_helper.cr b/tests/methods/check_top_level_imports.cr similarity index 70% rename from tests/spec_helper.cr rename to tests/methods/check_top_level_imports.cr index c708b14..1fa3983 100644 --- a/tests/spec_helper.cr +++ b/tests/methods/check_top_level_imports.cr @@ -1,21 +1,6 @@ require "spec" -require "http/client" -require "json" require "colorize" -def check_latest_commit(repository, branch = "master") - response = HTTP::Client.get "https://api.github.com/repos/#{repository}/branches/#{branch}" - response.status_code.should eq(200) - json = JSON.parse(response.body) - - File.read_lines("./overlays/#{repository.split("/")[1]}/default.nix").each do |line| - if line.includes? "version =" - nix_hash = line.split('"')[1] - json["commit"]["sha"].should eq(nix_hash) - end - end -end - hint = "" def check_top_level_imports(directory)