travis-yaml 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/.rspec +3 -0
- data/.travis.yml +14 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +73 -0
- data/LICENSE +22 -0
- data/README.md +232 -0
- data/Rakefile +3 -0
- data/SPEC.md +1018 -0
- data/bench/parser_bench.rb +54 -0
- data/config.ru +2 -0
- data/lib/travis/yaml.rb +43 -0
- data/lib/travis/yaml/matrix.rb +65 -0
- data/lib/travis/yaml/nodes.rb +40 -0
- data/lib/travis/yaml/nodes/branches.rb +12 -0
- data/lib/travis/yaml/nodes/bundler_args.rb +6 -0
- data/lib/travis/yaml/nodes/cache.rb +29 -0
- data/lib/travis/yaml/nodes/compiler.rb +7 -0
- data/lib/travis/yaml/nodes/compiler_entry.rb +9 -0
- data/lib/travis/yaml/nodes/deploy.rb +7 -0
- data/lib/travis/yaml/nodes/deploy_conditions.rb +12 -0
- data/lib/travis/yaml/nodes/deploy_entry.rb +10 -0
- data/lib/travis/yaml/nodes/env.rb +36 -0
- data/lib/travis/yaml/nodes/fixed_value.rb +60 -0
- data/lib/travis/yaml/nodes/git.rb +9 -0
- data/lib/travis/yaml/nodes/jdk.rb +11 -0
- data/lib/travis/yaml/nodes/language.rb +18 -0
- data/lib/travis/yaml/nodes/language_specific.rb +45 -0
- data/lib/travis/yaml/nodes/mapping.rb +204 -0
- data/lib/travis/yaml/nodes/matrix.rb +36 -0
- data/lib/travis/yaml/nodes/node.rb +102 -0
- data/lib/travis/yaml/nodes/notifications.rb +77 -0
- data/lib/travis/yaml/nodes/open_mapping.rb +18 -0
- data/lib/travis/yaml/nodes/os.rb +21 -0
- data/lib/travis/yaml/nodes/os_entry.rb +19 -0
- data/lib/travis/yaml/nodes/root.rb +44 -0
- data/lib/travis/yaml/nodes/ruby.rb +11 -0
- data/lib/travis/yaml/nodes/scalar.rb +97 -0
- data/lib/travis/yaml/nodes/sequence.rb +84 -0
- data/lib/travis/yaml/nodes/stage.rb +6 -0
- data/lib/travis/yaml/nodes/version.rb +6 -0
- data/lib/travis/yaml/nodes/version_list.rb +7 -0
- data/lib/travis/yaml/nodes/virtual_env.rb +7 -0
- data/lib/travis/yaml/parser.rb +31 -0
- data/lib/travis/yaml/parser/dummy.rb +13 -0
- data/lib/travis/yaml/parser/psych.rb +217 -0
- data/lib/travis/yaml/parser/ruby.rb +77 -0
- data/lib/travis/yaml/secure_string.rb +12 -0
- data/lib/travis/yaml/version.rb +5 -0
- data/play/lint.rb +8 -0
- data/play/spec.rb +183 -0
- data/play/weblint.rb +296 -0
- data/spec/nodes/.rb +0 -0
- data/spec/nodes/branches_spec.rb +45 -0
- data/spec/nodes/bundler_args_spec.rb +9 -0
- data/spec/nodes/cache_spec.rb +55 -0
- data/spec/nodes/compiler_spec.rb +14 -0
- data/spec/nodes/deploy_spec.rb +83 -0
- data/spec/nodes/git_spec.rb +55 -0
- data/spec/nodes/jdk_spec.rb +41 -0
- data/spec/nodes/language_spec.rb +79 -0
- data/spec/nodes/notifications_spec.rb +45 -0
- data/spec/nodes/os_spec.rb +28 -0
- data/spec/nodes/ruby_spec.rb +69 -0
- data/spec/nodes/stage_spec.rb +34 -0
- data/spec/nodes/virtual_env_spec.rb +9 -0
- data/spec/parser/dummy_spec.rb +7 -0
- data/spec/parser/ruby_spec.rb +41 -0
- data/spec/support.rb +3 -0
- data/spec/support/coverage.rb +11 -0
- data/spec/support/environment.rb +1 -0
- data/spec/yaml_spec.rb +26 -0
- data/travis-yaml.gemspec +24 -0
- metadata +207 -0
data/spec/nodes/.rb
ADDED
File without changes
|
@@ -0,0 +1,45 @@
|
|
1
|
+
describe Travis::Yaml::Nodes::Branches do
|
2
|
+
context 'from Ruby' do
|
3
|
+
specify 'with string' do
|
4
|
+
config = Travis::Yaml.parse(branches: 'foo')
|
5
|
+
expect(config.branches).to be == { 'only' => ['foo'] }
|
6
|
+
end
|
7
|
+
|
8
|
+
specify 'with regexp' do
|
9
|
+
config = Travis::Yaml.parse(branches: /foo/)
|
10
|
+
expect(config.branches).to be == { 'only' => [/foo/] }
|
11
|
+
end
|
12
|
+
|
13
|
+
specify 'with array' do
|
14
|
+
config = Travis::Yaml.parse(branches: [/foo/, 'bar'])
|
15
|
+
expect(config.branches).to be == { 'only' => [/foo/, 'bar'] }
|
16
|
+
end
|
17
|
+
|
18
|
+
specify 'with hash' do
|
19
|
+
config = Travis::Yaml.parse(branches: { except: /foo/ })
|
20
|
+
expect(config.branches).to be == { 'except' => [/foo/] }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'from YAML' do
|
25
|
+
specify 'with string' do
|
26
|
+
config = Travis::Yaml.parse('branches: foo')
|
27
|
+
expect(config.branches).to be == { 'only' => ['foo'] }
|
28
|
+
end
|
29
|
+
|
30
|
+
specify 'with regexp' do
|
31
|
+
config = Travis::Yaml.parse('branches: /foo/')
|
32
|
+
expect(config.branches).to be == { 'only' => [/foo/] }
|
33
|
+
end
|
34
|
+
|
35
|
+
specify 'with array' do
|
36
|
+
config = Travis::Yaml.parse('branches: [/foo/, bar]')
|
37
|
+
expect(config.branches).to be == { 'only' => [/foo/, 'bar'] }
|
38
|
+
end
|
39
|
+
|
40
|
+
specify 'with hash' do
|
41
|
+
config = Travis::Yaml.parse('branches: { except: /foo/ }')
|
42
|
+
expect(config.branches).to be == { 'except' => [/foo/] }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
describe Travis::Yaml::Nodes::BundlerArgs do
|
2
|
+
context 'from Ruby' do
|
3
|
+
specify 'can only be set for Ruby' do
|
4
|
+
expect(Travis::Yaml.parse(language: 'ruby', bundler_args: '--local').warnings).to be_empty
|
5
|
+
expect(Travis::Yaml.parse(language: 'php', bundler_args: '--local').warnings).to \
|
6
|
+
include('specified "bundler_args", but setting is not relevant for "php"')
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
describe Travis::Yaml::Nodes::Cache do
|
2
|
+
context 'from Ruby' do
|
3
|
+
specify 'with true' do
|
4
|
+
config = Travis::Yaml.parse(cache: true)
|
5
|
+
expect(config.cache).to be == { 'apt' => true, 'bundler' => true }
|
6
|
+
end
|
7
|
+
|
8
|
+
specify 'with false' do
|
9
|
+
config = Travis::Yaml.parse(cache: false)
|
10
|
+
expect(config.cache).to be == { 'apt' => false, 'bundler' => false }
|
11
|
+
end
|
12
|
+
|
13
|
+
specify 'with string' do
|
14
|
+
config = Travis::Yaml.parse(cache: 'apt')
|
15
|
+
expect(config.cache).to be == { 'apt' => true }
|
16
|
+
end
|
17
|
+
|
18
|
+
specify 'with array' do
|
19
|
+
config = Travis::Yaml.parse(cache: ['apt', 'bundler'])
|
20
|
+
expect(config.cache).to be == { 'apt' => true, 'bundler' => true }
|
21
|
+
end
|
22
|
+
|
23
|
+
specify 'with hash' do
|
24
|
+
config = Travis::Yaml.parse(cache: { bundler: true, directories: ['a', 'b'] })
|
25
|
+
expect(config.cache).to be == { 'bundler' => true, 'directories' => ['a', 'b'] }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'from YAML' do
|
30
|
+
specify 'with true' do
|
31
|
+
config = Travis::Yaml.parse('cache: on')
|
32
|
+
expect(config.cache).to be == { 'apt' => true, 'bundler' => true }
|
33
|
+
end
|
34
|
+
|
35
|
+
specify 'with false' do
|
36
|
+
config = Travis::Yaml.parse('cache: off')
|
37
|
+
expect(config.cache).to be == { 'apt' => false, 'bundler' => false }
|
38
|
+
end
|
39
|
+
|
40
|
+
specify 'with string' do
|
41
|
+
config = Travis::Yaml.parse('cache: apt')
|
42
|
+
expect(config.cache).to be == { 'apt' => true }
|
43
|
+
end
|
44
|
+
|
45
|
+
specify 'with array' do
|
46
|
+
config = Travis::Yaml.parse('cache: [apt, bundler]')
|
47
|
+
expect(config.cache).to be == { 'apt' => true, 'bundler' => true }
|
48
|
+
end
|
49
|
+
|
50
|
+
specify 'with hash' do
|
51
|
+
config = Travis::Yaml.parse('cache: { bundler: true, directories: [a, b] }')
|
52
|
+
expect(config.cache).to be == { 'bundler' => true, 'directories' => ['a', 'b'] }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
describe Travis::Yaml::Nodes::Compiler do
|
2
|
+
context 'from Ruby' do
|
3
|
+
specify 'can only be set for C++ and C' do
|
4
|
+
expect(Travis::Yaml.parse(language: 'c', compiler: 'gcc').warnings).to be_empty
|
5
|
+
expect(Travis::Yaml.parse(language: 'c++', compiler: 'gcc').warnings).to be_empty
|
6
|
+
expect(Travis::Yaml.parse(language: 'ruby', compiler: 'gcc').warnings).to include('specified "compiler", but setting is not relevant for "ruby"')
|
7
|
+
end
|
8
|
+
|
9
|
+
specify 'allows an array' do
|
10
|
+
config = Travis::Yaml.parse(language: 'c', compiler: ['gcc', 'clang'])
|
11
|
+
expect(config.compiler).to be == ['gcc', 'clang']
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
describe Travis::Yaml::Nodes::Deploy do
|
2
|
+
describe 'from ruby' do
|
3
|
+
specify 'empty section' do
|
4
|
+
config = Travis::Yaml.parse(deploy: {})
|
5
|
+
expect(config.deploy).to be_nil
|
6
|
+
expect(config.nested_warnings).to include([[], 'value for "deploy" section is empty, dropping'])
|
7
|
+
end
|
8
|
+
|
9
|
+
specify 'without provider' do
|
10
|
+
config = Travis::Yaml.parse(deploy: { foo: :bar })
|
11
|
+
expect(config.deploy).to be_nil
|
12
|
+
expect(config.nested_warnings).to include([['deploy'], 'missing key "provider"'])
|
13
|
+
expect(config.nested_warnings).to include([[], 'value for "deploy" section is empty, dropping'])
|
14
|
+
end
|
15
|
+
|
16
|
+
specify 'with a string' do
|
17
|
+
config = Travis::Yaml.parse(deploy: 'heroku')
|
18
|
+
expect(config.deploy) .to be == [{"provider" => "heroku"}]
|
19
|
+
expect(config.deploy.nested_warnings) .to be_empty
|
20
|
+
end
|
21
|
+
|
22
|
+
specify 'with one provider' do
|
23
|
+
config = Travis::Yaml.parse(deploy: { provider: :heroku })
|
24
|
+
expect(config.deploy) .to be == [{"provider" => "heroku"}]
|
25
|
+
expect(config.deploy.nested_warnings) .to be_empty
|
26
|
+
end
|
27
|
+
|
28
|
+
specify 'with multiple providers' do
|
29
|
+
config = Travis::Yaml.parse(deploy: [{ provider: :heroku }, { provider: :heroku }])
|
30
|
+
expect(config.deploy) .to be == [{"provider" => "heroku"}, {"provider" => "heroku"}]
|
31
|
+
expect(config.deploy.nested_warnings) .to be_empty
|
32
|
+
end
|
33
|
+
|
34
|
+
specify 'stores arbitrary data' do
|
35
|
+
config = Travis::Yaml.parse(deploy: { provider: :heroku, foo: :bar })
|
36
|
+
expect(config.deploy.first['foo']) .to be == "bar"
|
37
|
+
expect(config.deploy.nested_warnings) .to be_empty
|
38
|
+
end
|
39
|
+
|
40
|
+
specify 'with conditions' do
|
41
|
+
config = Travis::Yaml.parse(deploy: { provider: :heroku, on: :production })
|
42
|
+
expect(config.deploy.first.on.branch).to be == "production"
|
43
|
+
end
|
44
|
+
|
45
|
+
specify 'with multiple conditions' do
|
46
|
+
config = Travis::Yaml.parse(deploy: { provider: :heroku, on: { rvm: "2.0.0", repo: 'foo/bar', tags: true } })
|
47
|
+
expect(config.deploy.first.on).to be == { 'ruby' => '2.0.0', 'repo' => 'foo/bar', 'tags' => true }
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe 'from yaml' do
|
52
|
+
specify 'empty section' do
|
53
|
+
config = Travis::Yaml.parse('deploy: ')
|
54
|
+
expect(config.deploy).to be_nil
|
55
|
+
expect(config.nested_warnings).to include([[], 'value for "deploy" section is empty, dropping'])
|
56
|
+
end
|
57
|
+
|
58
|
+
specify 'without provider' do
|
59
|
+
config = Travis::Yaml.parse('deploy: { foo: bar }')
|
60
|
+
expect(config.deploy).to be_nil
|
61
|
+
expect(config.nested_warnings).to include([['deploy'], 'missing key "provider"'])
|
62
|
+
expect(config.nested_warnings).to include([[], 'value for "deploy" section is empty, dropping'])
|
63
|
+
end
|
64
|
+
|
65
|
+
specify 'with one provider' do
|
66
|
+
config = Travis::Yaml.parse('deploy: { provider: heroku }')
|
67
|
+
expect(config.deploy) .to be == [{"provider" => "heroku"}]
|
68
|
+
expect(config.deploy.nested_warnings) .to be_empty
|
69
|
+
end
|
70
|
+
|
71
|
+
specify 'with multiple providers' do
|
72
|
+
config = Travis::Yaml.parse('deploy: [{ provider: heroku }, { provider: heroku }]')
|
73
|
+
expect(config.deploy) .to be == [{"provider" => "heroku"}, {"provider" => "heroku"}]
|
74
|
+
expect(config.deploy.nested_warnings) .to be_empty
|
75
|
+
end
|
76
|
+
|
77
|
+
specify 'stores arbitrary data' do
|
78
|
+
config = Travis::Yaml.parse('deploy: { provider: heroku, foo: bar }')
|
79
|
+
expect(config.deploy.first['foo']) .to be == "bar"
|
80
|
+
expect(config.deploy.nested_warnings) .to be_empty
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
describe Travis::Yaml::Nodes::Git do
|
2
|
+
context 'from Ruby' do
|
3
|
+
describe :depth do
|
4
|
+
specify 'is integer' do
|
5
|
+
expect(Travis::Yaml.parse(git: { depth: 42 }).git.depth).to be == 42
|
6
|
+
end
|
7
|
+
|
8
|
+
specify 'complains about non-integer values' do
|
9
|
+
expect(Travis::Yaml.parse(git: { depth: "foo" }).nested_warnings).to \
|
10
|
+
include([['git'], 'dropping "depth" section: "str" not supported, dropping "foo"'])
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe :submodules do
|
15
|
+
specify 'is integer' do
|
16
|
+
expect(Travis::Yaml.parse(git: { submodules: false }).git.submodules).to be == false
|
17
|
+
end
|
18
|
+
|
19
|
+
specify 'complains about non-integer values' do
|
20
|
+
expect(Travis::Yaml.parse(git: { submodules: "foo" }).nested_warnings).to \
|
21
|
+
include([['git'], 'dropping "submodules" section: "str" not supported, dropping "foo"'])
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe :strategy do
|
26
|
+
specify 'can be clone' do
|
27
|
+
expect(Travis::Yaml.parse(git: { strategy: :clone }).git.strategy).to be == "clone"
|
28
|
+
end
|
29
|
+
|
30
|
+
specify 'can be tarball' do
|
31
|
+
expect(Travis::Yaml.parse(git: { strategy: :tarball }).git.strategy).to be == "tarball"
|
32
|
+
end
|
33
|
+
|
34
|
+
specify 'cannot be foo' do
|
35
|
+
expect(Travis::Yaml.parse(git: { strategy: :foo }).nested_warnings).to \
|
36
|
+
include([['git'], 'dropping "strategy" section: illegal value "foo"'])
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
context 'from YAML' do
|
42
|
+
describe :depth do
|
43
|
+
specify 'is integer' do
|
44
|
+
expect(Travis::Yaml.parse("git: { depth: 42 }").git.depth).to be == 42
|
45
|
+
end
|
46
|
+
|
47
|
+
specify 'complains about non-integer values' do
|
48
|
+
expect(Travis::Yaml.parse('git: { depth: !str foo }').nested_warnings).to \
|
49
|
+
include([['git'], 'dropping "depth" section: "str" not supported, dropping "foo"'])
|
50
|
+
expect(Travis::Yaml.parse('git: { depth: foo }').nested_warnings).to \
|
51
|
+
include([['git'], 'dropping "depth" section: failed to parse "int" - invalid value for Integer(): "foo"'])
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
describe Travis::Yaml::Nodes::JDK do
|
2
|
+
context 'from ruby' do
|
3
|
+
specify 'java' do
|
4
|
+
config = Travis::Yaml.parse(language: :java, jdk: 'default')
|
5
|
+
expect(config.jdk).to be == ['default']
|
6
|
+
end
|
7
|
+
|
8
|
+
specify 'scala' do
|
9
|
+
config = Travis::Yaml.parse(language: :scala, jdk: 'default')
|
10
|
+
expect(config.jdk).to be == ['default']
|
11
|
+
end
|
12
|
+
|
13
|
+
specify 'clojure' do
|
14
|
+
config = Travis::Yaml.parse(language: :clojure, jdk: 'default')
|
15
|
+
expect(config.jdk).to be == ['default']
|
16
|
+
end
|
17
|
+
|
18
|
+
specify 'groovy' do
|
19
|
+
config = Travis::Yaml.parse(language: :groovy, jdk: 'default')
|
20
|
+
expect(config.jdk).to be == ['default']
|
21
|
+
end
|
22
|
+
|
23
|
+
specify 'c' do
|
24
|
+
config = Travis::Yaml.parse(language: :c, jdk: 'default')
|
25
|
+
expect(config.jdk).to be_nil
|
26
|
+
expect(config.warnings).to include('specified "jdk", but setting is not relevant for "c"')
|
27
|
+
end
|
28
|
+
|
29
|
+
specify 'ruby without jruby' do
|
30
|
+
config = Travis::Yaml.parse(language: :ruby, jdk: 'default')
|
31
|
+
expect(config.jdk).to be_nil
|
32
|
+
expect(config.warnings).to include('dropping "jdk" section: specified "jdk", but "ruby" does not include "jruby"')
|
33
|
+
end
|
34
|
+
|
35
|
+
specify 'ruby with jruby' do
|
36
|
+
config = Travis::Yaml.parse(language: :ruby, jdk: 'default', ruby: ['2.0.0', 'jruby'])
|
37
|
+
expect(config.jdk).to be == ['default']
|
38
|
+
expect(config.warnings).to be_empty
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
describe Travis::Yaml::Nodes::Language do
|
2
|
+
context 'from ruby' do
|
3
|
+
specify 'default language' do
|
4
|
+
config = Travis::Yaml.parse({})
|
5
|
+
expect(config.language).to be == 'ruby'
|
6
|
+
expect(config.nested_warnings).to include([[], "missing key \"language\", defaulting to \"ruby\""])
|
7
|
+
end
|
8
|
+
|
9
|
+
specify 'set to valid language' do
|
10
|
+
expect(Travis::Yaml.parse(language: 'php').language).to be == 'php'
|
11
|
+
end
|
12
|
+
|
13
|
+
specify 'ignores case' do
|
14
|
+
expect(Travis::Yaml.parse(language: 'PHP').language).to be == 'php'
|
15
|
+
end
|
16
|
+
|
17
|
+
specify 'set to an invalid language' do
|
18
|
+
config = Travis::Yaml.parse(language: 'sql')
|
19
|
+
expect(config.language).to be == 'ruby'
|
20
|
+
expect(config.nested_warnings).to include([["language"], "illegal value \"sql\", defaulting to \"ruby\""])
|
21
|
+
end
|
22
|
+
|
23
|
+
specify 'supports aliases' do
|
24
|
+
config = Travis::Yaml.parse(language: 'javascript')
|
25
|
+
expect(config.language).to be == 'node_js'
|
26
|
+
end
|
27
|
+
|
28
|
+
specify 'supports singe element arrays' do
|
29
|
+
config = Travis::Yaml.parse(language: ['javascript'])
|
30
|
+
expect(config.language) .to be == 'node_js'
|
31
|
+
expect(config.language.warnings) .to be_empty
|
32
|
+
end
|
33
|
+
|
34
|
+
specify 'complains about multi element arrays' do
|
35
|
+
config = Travis::Yaml.parse(language: ['javascript', 'ruby'])
|
36
|
+
expect(config.language) .to be == 'node_js'
|
37
|
+
expect(config.language.warnings) .to include('does not support multiple values, dropping "ruby"')
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
context 'from yaml' do
|
42
|
+
specify 'default language' do
|
43
|
+
config = Travis::Yaml.parse('')
|
44
|
+
expect(config.language).to be == 'ruby'
|
45
|
+
expect(config.nested_warnings).to include([[], "missing key \"language\", defaulting to \"ruby\""])
|
46
|
+
end
|
47
|
+
|
48
|
+
specify 'set to valid language' do
|
49
|
+
expect(Travis::Yaml.parse('language: php').language).to be == 'php'
|
50
|
+
end
|
51
|
+
|
52
|
+
specify 'ignores case' do
|
53
|
+
expect(Travis::Yaml.parse('language: PHP').language).to be == 'php'
|
54
|
+
end
|
55
|
+
|
56
|
+
specify 'set to an invalid language' do
|
57
|
+
config = Travis::Yaml.parse('language: sql')
|
58
|
+
expect(config.language).to be == 'ruby'
|
59
|
+
expect(config.nested_warnings).to include([["language"], "illegal value \"sql\", defaulting to \"ruby\""])
|
60
|
+
end
|
61
|
+
|
62
|
+
specify 'supports aliases' do
|
63
|
+
config = Travis::Yaml.parse('language: javascript')
|
64
|
+
expect(config.language).to be == 'node_js'
|
65
|
+
end
|
66
|
+
|
67
|
+
specify 'supports singe element arrays' do
|
68
|
+
config = Travis::Yaml.parse("language: [javascript]")
|
69
|
+
expect(config.language) .to be == 'node_js'
|
70
|
+
expect(config.language.warnings) .to be_empty
|
71
|
+
end
|
72
|
+
|
73
|
+
specify 'complains about multi element arrays' do
|
74
|
+
config = Travis::Yaml.parse("language: [javascript, ruby]")
|
75
|
+
expect(config.language) .to be == 'node_js'
|
76
|
+
expect(config.language.warnings) .to include('does not support multiple values, dropping "ruby"')
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
describe Travis::Yaml::Nodes::Notifications do
|
2
|
+
context :email do
|
3
|
+
example "disabled via false" do
|
4
|
+
config = Travis::Yaml.parse(notifications: { email: false })
|
5
|
+
expect(config.notifications.email).to be_disabled
|
6
|
+
expect(config.notifications.email).not_to be_enabled
|
7
|
+
end
|
8
|
+
|
9
|
+
example "disabled via disabled: true" do
|
10
|
+
config = Travis::Yaml.parse(notifications: { email: { disabled: true } })
|
11
|
+
expect(config.notifications.email).to be_disabled
|
12
|
+
expect(config.notifications.email).not_to be_enabled
|
13
|
+
end
|
14
|
+
|
15
|
+
example "disabled via enabled: false" do
|
16
|
+
config = Travis::Yaml.parse(notifications: { email: { enabled: false } })
|
17
|
+
expect(config.notifications.email).to be_disabled
|
18
|
+
expect(config.notifications.email).not_to be_enabled
|
19
|
+
end
|
20
|
+
|
21
|
+
example "enabled by default" do
|
22
|
+
config = Travis::Yaml.parse(notifications: { email: { recipients: "example@rkh.im" } })
|
23
|
+
expect(config.notifications.email).not_to be_disabled
|
24
|
+
expect(config.notifications.email).to be_enabled
|
25
|
+
end
|
26
|
+
|
27
|
+
example "enabled via true" do
|
28
|
+
config = Travis::Yaml.parse(notifications: { email: true })
|
29
|
+
expect(config.notifications.email).not_to be_disabled
|
30
|
+
expect(config.notifications.email).to be_enabled
|
31
|
+
end
|
32
|
+
|
33
|
+
example "disabled via disabled: true" do
|
34
|
+
config = Travis::Yaml.parse(notifications: { email: { disabled: false } })
|
35
|
+
expect(config.notifications.email).not_to be_disabled
|
36
|
+
expect(config.notifications.email).to be_enabled
|
37
|
+
end
|
38
|
+
|
39
|
+
example "disabled via enabled: false" do
|
40
|
+
config = Travis::Yaml.parse(notifications: { email: { enabled: true } })
|
41
|
+
expect(config.notifications.email).not_to be_disabled
|
42
|
+
expect(config.notifications.email).to be_enabled
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
describe Travis::Yaml::Nodes::OS do
|
2
|
+
specify 'defaults to linux' do
|
3
|
+
expect(Travis::Yaml.new.os).to be == ['linux']
|
4
|
+
end
|
5
|
+
|
6
|
+
specify 'defaults to osx for objective-c' do
|
7
|
+
config = Travis::Yaml.parse(language: :objc)
|
8
|
+
expect(config.os).to be == ['osx']
|
9
|
+
end
|
10
|
+
|
11
|
+
specify 'supports aliases' do
|
12
|
+
config = Travis::Yaml.parse(os: [:ubuntu, :mac], language: 'ruby')
|
13
|
+
expect(config.os).to be == ['linux', 'osx']
|
14
|
+
end
|
15
|
+
|
16
|
+
specify 'unsupported values' do
|
17
|
+
config = Travis::Yaml.parse(os: :windows)
|
18
|
+
expect(config.os).to be == ['linux']
|
19
|
+
expect(config.os.first.warnings).to include('illegal value "windows", defaulting to "linux"')
|
20
|
+
end
|
21
|
+
|
22
|
+
specify 'checks if the os suppors the language' do
|
23
|
+
config = Travis::Yaml.parse(os: :linux, language: :objc)
|
24
|
+
expect(config.os).to be == ['osx']
|
25
|
+
expect(config.os.warnings).to include('dropping "linux", does not support "objective-c"')
|
26
|
+
expect(config.os.warnings).to include('no suitable operating system given for "objective-c", using "osx"')
|
27
|
+
end
|
28
|
+
end
|