-
Notifications
You must be signed in to change notification settings - Fork 94
Expand file tree
/
Copy pathroot_spec.rb
More file actions
336 lines (317 loc) · 7.22 KB
/
root_spec.rb
File metadata and controls
336 lines (317 loc) · 7.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
require 'json'
describe Travis::Yml::Schema::Def::Root do
subject { Travis::Yml.schema }
# it { puts JSON.pretty_generate(subject) }
it { should include title: 'JSON schema for Travis CI configuration files' }
it { should include '$schema': 'http://json-schema.org/draft-04/schema#' }
describe 'secure' do
subject { Travis::Yml.schema[:definitions][:type][:secure] }
it do
should eq(
'$id': :secure,
title: 'Secure',
anyOf: [
{
type: :object,
properties: {
secure: {
type: :string
}
},
additionalProperties: false,
maxProperties: 1,
normal: true
},
{
type: :string,
normal: true
}
]
)
end
end
describe 'secures' do
subject { Travis::Yml.schema[:definitions][:type][:secures] }
it do
should eq(
'$id': :secures,
title: 'Secures',
anyOf: [
{
type: :array,
items: { '$ref': '#/definitions/type/secure' },
normal: true
},
{
'$ref': '#/definitions/type/secure'
}
]
)
end
end
describe 'strs' do
subject { Travis::Yml.schema[:definitions][:type][:strs] }
it do
should eq(
'$id': :strs,
'title': 'Strs', # ?
anyOf: [
{
type: :array,
minItems: 1,
items: {
anyOf: [
{ type: :string }
]
},
normal: true
},
{
type:
:string
},
]
)
end
end
describe 'keys' do
subject { Travis::Yml.schema[:definitions] }
definitions = {
type: %i(
addons
arch
archs
branches
cache
compilers
conditions
condition
deploys
dist
env
env_var
env_vars
git
group
import
imports
jdks
job
jobs
jobs_allow_failure
jobs_allow_failures
jobs_include
jobs_includes
jobs_exclude
jobs_excludes
language
languages
keys
notifications
os
oss
osx_images
perforce_test_path
secure
secures
service
services
stack
stage
stages
strs
sudo
support
vault
version
virt
vm
workspace
workspaces
),
addon: %i(
apt
artifacts
browserstack
code_climate
coverity_scan
homebrew
jwts
sauce_connect
snaps
pkg
sonarcloud
),
deploy: %i(
branches
conditions
edge
providers
anynines
azure_web_apps
bintray
bluemixcloudfoundry
boxfuse
cargo
chef_supermarket
cloud66
cloudfiles
cloudfoundry
cloudformation
codedeploy
convox
datica
elasticbeanstalk
engineyard
firebase
flynn
gae
gcs
git_push
gleis
hackage
hephy
heroku
lambda
launchpad
netlify
npm
openshift
opsworks
packagecloud
pages
puppetforge
pypi
releases
rubygems
s3
scalingo
script
snap
surge
testfairy
transifex
),
language: %i(
__amethyst__
__connie__
__cookiecat__
__garnet__
__onion__
__opal__
__sardonyx__
__stevonnie__
android
c
clojure
cpp
crystal
csharp
d
dart
elixir
elm
erlang
generic
go
groovy
hack
haskell
haxe
java
julia
matlab
nix
node_js
objective-c
perl
perl6
php
python
r
ruby
rust
scala
shell
smalltalk
),
notification: %i(
campfire
email
flowdock
frequency
hipchat
irc
pushover
slack
template
templates
webhooks
)
}
# %i(
# secure
# secures
# strs
# )
# it do
# p subject[:type].keys.sort
# p definitions[:type].sort
# end
definitions.each do |namespace, keys|
it { expect(subject[namespace].keys.sort).to eq keys.sort }
end
end
describe 'root' do
# it do
# should include allOf: [
# hash_including(type: :object),
# { '$ref': '#/definitions/type/job' }
# ]
# end
describe 'properties' do
subject { Travis::Yml.schema[:allOf][0][:properties] }
# it { puts JSON.pretty_generate(subject) }
it do
expect(subject.keys.sort).to eq %i(
arch
compiler
conditions
dist
env
filter_secrets
import
jobs
language
notifications
os
osx_image
perforce_test_path
stack
stages
sudo
trace
vault
version
vm
)
end
it { should include arch: { '$ref': '#/definitions/type/archs', flags: [:expand] } }
it { should include compiler: { '$ref': '#/definitions/type/compilers', flags: [:expand] } }
it { should include conditions: { '$ref': '#/definitions/type/conditions' } }
it { should include dist: { '$ref': '#/definitions/type/dist', defaults: [{ value: 'xenial', only: { os: ['linux', 'linux-ppc64le'] } }] } }
it { should include env: { '$ref': '#/definitions/type/env' } }
it { should include import: { '$ref': '#/definitions/type/imports' } }
# it { should include language: { '$ref': '#/definitions/type/language' } }
it { should include jobs: { '$ref': '#/definitions/type/jobs', aliases: [:matrix] } }
it { should include notifications: { '$ref': '#/definitions/type/notifications' } }
it { should include os: { '$ref': '#/definitions/type/oss', flags: [:expand], defaults: [{ value: 'linux', except: { language: ['objective-c'] } }, { value: 'osx', only: { language: ['objective-c'] } }] } }
it { should include stack: { '$ref': '#/definitions/type/stack' } }
it { should include stages: { '$ref': '#/definitions/type/stages' } }
it { should include sudo: { '$ref': '#/definitions/type/sudo' } }
it { should include version: { '$ref': '#/definitions/type/version' } }
it { should include filter_secrets: { type: :boolean, flags: [:internal], summary: 'Whether to filter secrets from the log output' } }
it { should include trace: { type: :boolean, flags: [:internal], summary: 'Whether to trace the build script' } }
end
end
end