-
Notifications
You must be signed in to change notification settings - Fork 437
/
go_spec.rb
68 lines (54 loc) · 1.72 KB
/
go_spec.rb
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
require 'spec_helper'
xdescribe Travis::Build::Script::Go, :sexp do #requires test image update
let(:data) { payload_for(:push, :go) }
let(:script) { described_class.new(data) }
let(:defaults) { described_class::DEFAULTS }
let(:go_import_path) { 'github.com/travis-ci-examples/go-example' }
subject { script.sexp }
it { store_example }
it { store_example(integration: true) }
it_behaves_like 'a bash script', integration: true do
let(:bash_script_file) { bash_script_path(integration: true) }
end
it_behaves_like 'a bash script'
it_behaves_like 'compiled script' do
let(:code) { ['TRAVIS_LANGUAGE=go'] }
let(:code) { ['go test'] }
end
it_behaves_like 'a build script sexp'
it 'sets the default go version if no :go config given' do
should include_sexp([
:cmd, %[travis_export_go #{defaults[:go]} #{go_import_path}],
echo: true
])
end
it 'sets the go version from config :go' do
data[:config][:go] = 'go1.22.5'
should include_sexp([
:cmd, %[travis_export_go 1.22.5 #{go_import_path}],
echo: true
])
end
it 'installs the go version' do
data[:config][:go] = 'go1.22'
should include_sexp([
:cmd, %[travis_export_go 1.22 #{go_import_path}],
echo: true
])
end
context 'when go version is an array' do
it 'installs the first version specified' do
data[:config][:go] = ['1.16']
should include_sexp([
:cmd, %[travis_export_go 1.16 #{go_import_path}],
echo: true
])
end
end
it 'announces go version' do
should include_sexp [:cmd, 'go version', echo: true]
end
it 'announces go env' do
should include_sexp [:cmd, 'go env', echo: true]
end
end