tests: Split methods into separate files

This commit is contained in:
Donovan Glover 2023-06-10 10:24:47 -04:00
parent 6c880d65a5
commit 9dacce9704
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65
3 changed files with 17 additions and 16 deletions

View File

@ -1,5 +1,5 @@
require "spec" require "spec"
require "./spec_helper" require "./methods/*"
check_top_level_imports("modules") check_top_level_imports("modules")
check_top_level_imports("overlays") check_top_level_imports("overlays")

View File

@ -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

View File

@ -1,21 +1,6 @@
require "spec" require "spec"
require "http/client"
require "json"
require "colorize" 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 = "" hint = ""
def check_top_level_imports(directory) def check_top_level_imports(directory)