/
default_test.rb
107 lines (88 loc) · 3.18 KB
/
default_test.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
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
# frozen_string_literal: true
control 'asdf_user_install' do
title 'Installs asdf'
desc 'Installs asdf'
describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/asdf.sh && which asdf"') do
its('exit_status') { should eq 0 }
end
desc 'Creates asdf.sh file'
describe file('/etc/profile.d/asdf.sh') do
it { should exist }
it { should be_file }
its('owner') { should eq 'root' }
end
desc 'Creates installs directory'
describe directory('/home/vagrant/.asdf/installs') do
it { should exist }
it { should be_directory }
its('owner') { should eq 'vagrant' }
end
desc 'Creates plugins directory'
describe directory('/home/vagrant/.asdf/plugins') do
it { should exist }
it { should be_directory }
its('owner') { should eq 'vagrant' }
end
desc 'Creates shims directory'
describe directory('/home/vagrant/.asdf/shims') do
it { should exist }
it { should be_directory }
its('owner') { should eq 'vagrant' }
end
desc 'Creates .asdfrc file'
describe file('/home/vagrant/.asdfrc') do
it { should exist }
it { should be_file }
its('owner') { should eq 'vagrant' }
its('content') { should eq 'legacy_version_file = no' }
end
end
control 'asdf_plugin' do
title 'Adds, updates and removed asdf plugins'
desc 'Adds and removes clojure plugin'
describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/asdf.sh && asdf plugin-list"') do
its('stdout') { should_not include('clojure') }
end
desc 'Adds nodejs plugin'
describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/asdf.sh && asdf plugin-list"') do
its('stdout') { should include('nodejs') }
end
desc 'Adds ruby plugin'
describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/asdf.sh && asdf plugin-list"') do
its('stdout') { should include('ruby') }
end
desc 'Adds php plugin'
describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/asdf.sh && asdf plugin-list"') do
its('stdout') { should include('php') }
end
end
control 'asdf_package' do
title 'Installs, uninstalls and sets global asdf packages'
desc 'Installs nodejs 10.12.0'
describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/asdf.sh && asdf list nodejs"') do
its('stdout') { should include('10.12.0') }
its('exit_status') { should eq 0 }
end
desc 'Sets nodejs 10.12.0 to global'
describe file('/home/vagrant/.tool-versions') do
its('content') { should include('nodejs 10.12.0') }
end
desc 'Installs ruby 2.5.1'
describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/asdf.sh && asdf list ruby"') do
its('stdout') { should include('2.5.1') }
its('exit_status') { should eq 0 }
end
desc 'Sets ruby 2.5.1 to global'
describe file('/home/vagrant/.tool-versions') do
its('content') { should include('ruby 2.5.1') }
end
desc 'Installs php 7.2.11'
describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/asdf.sh && asdf list php"') do
its('stdout') { should include('7.2.11') }
its('exit_status') { should eq 0 }
end
desc 'Sets php 7.2.11 to global'
describe file('/home/vagrant/.tool-versions') do
its('content') { should include('php 7.2.11') }
end
end