forked from extern/nix-config
tests: Split methods into separate files
This commit is contained in:
parent
6c880d65a5
commit
9dacce9704
@ -1,5 +1,5 @@
|
||||
require "spec"
|
||||
require "./spec_helper"
|
||||
require "./methods/*"
|
||||
|
||||
check_top_level_imports("modules")
|
||||
check_top_level_imports("overlays")
|
||||
|
16
tests/methods/check_latest_commit.cr
Normal file
16
tests/methods/check_latest_commit.cr
Normal 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
|
@ -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)
|
Loading…
Reference in New Issue
Block a user