Skip to content

Commit 303899d

Browse files
committed
add tests for settings schema
1 parent 1387b54 commit 303899d

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,7 @@ jobs:
7171
run: bundle exec run shellcheck
7272
- name: Run shfmt tests
7373
run: bundle exec run shfmt
74-
- name: Run schema tests
75-
run: bundle exec run schema
74+
- name: Run bashly schema tests
75+
run: bundle exec run schema examples
76+
- name: Run settings schema tests
77+
run: bundle exec run schema settings

support/runfile/schema.runfile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
summary 'Run json-schema checks on all examples'
22

3-
action do
3+
help 'Test the bashly schema against all examples'
4+
action :examples do
45
Example.all.each do |example|
56
file = example.yaml_path
67
command = "check-jsonschema --schemafile schemas/bashly.json #{file}"
8+
say "\n$ check-jsonschema bb`#{example.dir}`"
79
success = system command
8-
color = success ? 'g' : 'r'
9-
say "- check-jsonschema #{color}`#{example.dir}`"
1010
exit 1 unless success
1111
end
1212
end
13+
14+
help 'Test the settings schema against the default settings template'
15+
action :settings do
16+
file = 'lib/bashly/libraries/settings/settings.yml'
17+
command = "check-jsonschema --schemafile schemas/settings.json #{file}"
18+
say "\n$ check-jsonschema bb`#{file}`"
19+
success = system command
20+
exit 1 unless success
21+
end

0 commit comments

Comments
 (0)