omnibus 3.2.0.rc.1 → 3.2.0.rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -2
  3. data/Rakefile +2 -2
  4. data/lib/omnibus.rb +13 -4
  5. data/lib/omnibus/builder.rb +596 -248
  6. data/lib/omnibus/cleanroom.rb +7 -7
  7. data/lib/omnibus/cli/deprecated.rb +1 -1
  8. data/lib/omnibus/exceptions.rb +36 -5
  9. data/lib/omnibus/fetchers/net_fetcher.rb +4 -0
  10. data/lib/omnibus/git_cache.rb +3 -3
  11. data/lib/omnibus/instrumentation.rb +29 -0
  12. data/lib/omnibus/package.rb +98 -5
  13. data/lib/omnibus/packagers/base.rb +1 -0
  14. data/lib/omnibus/project.rb +5 -64
  15. data/lib/omnibus/publishers/artifactory_publisher.rb +4 -1
  16. data/lib/omnibus/software.rb +52 -29
  17. data/lib/omnibus/util.rb +11 -1
  18. data/lib/omnibus/version.rb +1 -1
  19. data/omnibus.gemspec +2 -3
  20. data/spec/data/complicated/config/software/libyaml-windows.rb +1 -1
  21. data/spec/functional/builder_spec.rb +305 -0
  22. data/spec/{functional → integration}/packagers/mac_spec.rb +0 -0
  23. data/spec/{functional → integration}/packagers/windows_spec.rb +0 -0
  24. data/spec/spec_helper.rb +8 -7
  25. data/spec/unit/build_version_dsl_spec.rb +77 -75
  26. data/spec/unit/build_version_spec.rb +4 -4
  27. data/spec/unit/builder_spec.rb +49 -0
  28. data/spec/unit/config_spec.rb +1 -1
  29. data/spec/unit/fetchers/git_fetcher_spec.rb +11 -11
  30. data/spec/unit/fetchers/net_fetcher_spec.rb +3 -5
  31. data/spec/unit/git_cache_spec.rb +2 -2
  32. data/spec/unit/package_spec.rb +118 -11
  33. data/spec/unit/packagers/base_spec.rb +17 -17
  34. data/spec/unit/packagers/mac_pkg_spec.rb +1 -1
  35. data/spec/unit/project_spec.rb +27 -101
  36. data/spec/unit/publisher_spec.rb +2 -2
  37. data/spec/unit/publishers/artifactory_publisher_spec.rb +8 -7
  38. data/spec/unit/publishers/s3_publisher_spec.rb +3 -3
  39. data/spec/unit/s3_cacher_spec.rb +2 -2
  40. data/spec/unit/software_spec.rb +26 -18
  41. metadata +27 -22
@@ -9,7 +9,7 @@ module Omnibus
9
9
  subject(:build_version) { described_class.new }
10
10
 
11
11
  before do
12
- described_class.any_instance.stub(:shellout)
12
+ allow_any_instance_of(described_class).to receive(:shellout)
13
13
  .and_return(double('ouput', stdout: git_describe, exitstatus: 0))
14
14
  end
15
15
 
@@ -144,7 +144,7 @@ module Omnibus
144
144
  end
145
145
 
146
146
  context 'when Config.append_timestamp is true' do
147
- before { Config.stub(:append_timestamp).and_return(true) }
147
+ before { Config.append_timestamp(true) }
148
148
 
149
149
  it 'appends a timestamp' do
150
150
  expect(build_version.semver).to match(/11.0.0-alpha.3\+#{today_string}[0-9]+.git.207.694b062/)
@@ -152,7 +152,7 @@ module Omnibus
152
152
  end
153
153
 
154
154
  context 'when Config.append_timestamp is false' do
155
- before { Config.stub(:append_timestamp).and_return(false) }
155
+ before { Config.append_timestamp(false) }
156
156
 
157
157
  it 'does not append a timestamp' do
158
158
  expect(build_version.semver).to match(/11.0.0-alpha.3\+git.207.694b062/)
@@ -188,7 +188,7 @@ module Omnibus
188
188
  fatal: No tags can describe '809ea1afcce67e1148c1bf0822d40a7ef12c380e'.
189
189
  Try --always, or create some tags.
190
190
  STDERR
191
- build_version.stub(:shellout)
191
+ allow(build_version).to receive(:shellout)
192
192
  .and_return(double('ouput', stderr: stderr, exitstatus: 128))
193
193
  end
194
194
  it 'sets the version to 0.0.0' do
@@ -0,0 +1,49 @@
1
+ require 'spec_helper'
2
+
3
+ module Omnibus
4
+ describe Builder do
5
+ let(:software) do
6
+ double(Software,
7
+ name: 'chefdk',
8
+ install_dir: '/opt/chefdk',
9
+ project_dir: '/opt/chefdk',
10
+ )
11
+ end
12
+
13
+ subject { described_class.new(software) }
14
+
15
+ context 'DSL methods' do
16
+ before do
17
+ allow(subject).to receive(:find_file).and_return([nil, '/path'])
18
+ end
19
+
20
+ it_behaves_like 'a cleanroom setter', :command, %|command 'echo "hello"'|
21
+ it_behaves_like 'a cleanroom setter', :patch, %|patch source: 'diff.patch'|
22
+ it_behaves_like 'a cleanroom getter', :max_build_jobs
23
+ it_behaves_like 'a cleanroom setter', :ruby, %|ruby '-e "puts"'|
24
+ it_behaves_like 'a cleanroom setter', :gem, %|gem 'install bacon'|
25
+ it_behaves_like 'a cleanroom setter', :bundle, %|bundle 'install'|
26
+ it_behaves_like 'a cleanroom setter', :block, <<-EOH.gsub(/^ {8}/, '')
27
+ block 'A named block' do
28
+ # Complex operation
29
+ end
30
+ EOH
31
+ it_behaves_like 'a cleanroom setter', :erb, <<-EOH.gsub(/^ {8}/, '')
32
+ erb source: 'template.erb',
33
+ dest: '/path/to/file',
34
+ vars: { a: 'b', c: 'd' }
35
+ EOH
36
+ it_behaves_like 'a cleanroom setter', :mkdir, %|mkdir 'path'|
37
+ it_behaves_like 'a cleanroom setter', :touch, %|touch 'file'|
38
+ it_behaves_like 'a cleanroom setter', :delete, %|delete 'file'|
39
+ it_behaves_like 'a cleanroom setter', :copy, %|copy 'file', 'file2'|
40
+ it_behaves_like 'a cleanroom setter', :move, %|move 'file', 'file2'|
41
+ it_behaves_like 'a cleanroom setter', :link, %|link 'file', 'file2'|
42
+ it_behaves_like 'a cleanroom getter', :project_root, %|puts project_root|
43
+
44
+ # From software
45
+ it_behaves_like 'a cleanroom getter', :project_dir
46
+ it_behaves_like 'a cleanroom getter', :install_dir
47
+ end
48
+ end
49
+ end
@@ -25,7 +25,7 @@ module Omnibus
25
25
  end
26
26
 
27
27
  it_behaves_like 'a cleanroom getter', id, default
28
- it_behaves_like 'a cleanroom setter', id, default
28
+ it_behaves_like 'a cleanroom setter', id, %|#{id}(#{default.inspect})|
29
29
  end
30
30
 
31
31
  include_examples 'a configurable', :base_dir, '/var/cache/omnibus'
@@ -16,12 +16,12 @@ module Omnibus
16
16
  describe '#fetch' do
17
17
  context 'when the project is cloned' do
18
18
  before do
19
- subject.stub(:existing_git_clone?).and_return(true)
20
- subject.stub(:fetch_updates)
19
+ allow(subject).to receive(:existing_git_clone?).and_return(true)
20
+ allow(subject).to receive(:fetch_updates)
21
21
  end
22
22
 
23
23
  context 'when the rev matches' do
24
- before { subject.stub(:current_rev_matches_target_rev?).and_return(true) }
24
+ before { allow(subject).to receive(:current_rev_matches_target_rev?).and_return(true) }
25
25
 
26
26
  it 'does not fetch updates' do
27
27
  expect(subject).to_not receive(:fetch_updates)
@@ -30,7 +30,7 @@ module Omnibus
30
30
  end
31
31
 
32
32
  context 'when the rev does not match' do
33
- before { subject.stub(:current_rev_matches_target_rev?).and_return(false) }
33
+ before { allow(subject).to receive(:current_rev_matches_target_rev?).and_return(false) }
34
34
 
35
35
  it 'fetches the updates' do
36
36
  expect(subject).to receive(:fetch_updates).once
@@ -41,9 +41,9 @@ module Omnibus
41
41
 
42
42
  context 'when the project is not cloned' do
43
43
  before do
44
- subject.stub(:existing_git_clone?).and_return(false)
45
- subject.stub(:clone)
46
- subject.stub(:checkout)
44
+ allow(subject).to receive(:existing_git_clone?).and_return(false)
45
+ allow(subject).to receive(:clone)
46
+ allow(subject).to receive(:checkout)
47
47
  end
48
48
 
49
49
  it 'clones the project' do
@@ -61,14 +61,14 @@ module Omnibus
61
61
  let(:error_reporter) { double(Fetcher::ErrorReporter, explain: nil) }
62
62
 
63
63
  before do
64
- subject.stub(:existing_git_clone?).and_return(false)
65
- subject.stub(:clone).and_raise(RuntimeError)
64
+ allow(subject).to receive(:existing_git_clone?).and_return(false)
65
+ allow(subject).to receive(:clone).and_raise(RuntimeError)
66
66
 
67
- Fetcher::ErrorReporter.stub(:new).and_return(error_reporter)
67
+ allow(Fetcher::ErrorReporter).to receive(:new).and_return(error_reporter)
68
68
  end
69
69
 
70
70
  it 'retries 4 times' do
71
- subject.stub(:sleep)
71
+ allow(subject).to receive(:sleep)
72
72
  expect(subject).to receive(:clone).exactly(4).times
73
73
  expect { subject.fetch }.to raise_error(RuntimeError)
74
74
  end
@@ -20,13 +20,11 @@ module Omnibus
20
20
  shared_examples 'an extractor' do |extension, command|
21
21
  context "when the file is a .#{extension}" do
22
22
  before do
23
- software_mock.stub(
24
- project_file: "file.#{extension}",
25
- source_uri: "http://example.com/file.#{extension}",
26
- )
23
+ allow(software_mock).to receive(:project_file).and_return("file.#{extension}")
24
+ allow(software_mock).to receive(:source_uri).and_return("http://example.com/file.#{extension}")
27
25
  end
28
26
 
29
- it 'downloads and decompresses the archive' do
27
+ it 'has the correct extract command' do
30
28
  expect(subject.extract_cmd).to eq(command)
31
29
  end
32
30
  end
@@ -68,7 +68,7 @@ module Omnibus
68
68
 
69
69
  describe '#tag' do
70
70
  it 'returns the correct tag' do
71
- expect(ipc.tag).to eql('zlib-329d861e3928a74938f1ff9ff2672ea4e1c0b6ac3b7f32e66fd61064f516f751')
71
+ expect(ipc.tag).to eql('zlib-25a09c83aca0f38a6e9d0d555358e772cde7ae7c40214edf108f1d1fded96bc7')
72
72
  end
73
73
 
74
74
  describe 'with no deps' do
@@ -77,7 +77,7 @@ module Omnibus
77
77
  end
78
78
 
79
79
  it 'returns the correct tag' do
80
- expect(ipc.tag).to eql('zlib-4093b06ca5b22654b650a207736136964a1e8a362548a058702adbf501955189')
80
+ expect(ipc.tag).to eql('zlib-4315c8f2f9a0850b6fabeeaffe1f2dde4a3b52a234cc5e9bfaaf37f2280c6829')
81
81
  end
82
82
  end
83
83
  end
@@ -25,31 +25,138 @@ module Omnibus
25
25
 
26
26
  describe '.generate' do
27
27
  it 'writes out the file' do
28
- described_class.stub(:new).and_return(instance)
28
+ allow(described_class).to receive(:new).and_return(instance)
29
29
  expect(instance).to receive(:save).once
30
30
 
31
31
  described_class.generate(package, data)
32
32
  end
33
+
34
+ describe '#arch' do
35
+ it 'returns the architecture' do
36
+ stub_ohai(platform: 'ubuntu', version: '12.04') do |data|
37
+ data['kernel']['machine'] = 'x86_64'
38
+ end
39
+ expect(described_class.arch).to eq('x86_64')
40
+ end
41
+ end
42
+
43
+ describe '#platform_shortname' do
44
+ it 'returns el on rhel' do
45
+ stub_ohai(platform: 'redhat', version: '6.4')
46
+ expect(described_class.platform_shortname).to eq('el')
47
+ end
48
+
49
+ it 'returns #platform on non-rhel systems' do
50
+ stub_ohai(platform: 'ubuntu', version: '12.04')
51
+ expect(described_class.platform_shortname).to eq('ubuntu')
52
+ end
53
+ end
54
+
55
+ describe '#platform_version' do
56
+ shared_examples 'a version manipulator' do |platform_shortname, version, expected|
57
+ context "on #{platform_shortname}-#{version}" do
58
+ it 'returns the correct value' do
59
+ stub_ohai(platform: 'ubuntu', version: '12.04') do |data|
60
+ data['platform'] = platform_shortname
61
+ data['platform_version'] = version
62
+ end
63
+
64
+ expect(described_class.platform_version).to eq(expected)
65
+ end
66
+ end
67
+ end
68
+
69
+ it_behaves_like 'a version manipulator', 'arch', '2009.02', '2009.02'
70
+ it_behaves_like 'a version manipulator', 'arch', '2014.06.01', '2014.06'
71
+ it_behaves_like 'a version manipulator', 'debian', '7.1', '7'
72
+ it_behaves_like 'a version manipulator', 'debian', '6.9', '6'
73
+ it_behaves_like 'a version manipulator', 'ubuntu', '10.04', '10.04'
74
+ it_behaves_like 'a version manipulator', 'ubuntu', '10.04.04', '10.04'
75
+ it_behaves_like 'a version manipulator', 'fedora', '11.5', '11'
76
+ it_behaves_like 'a version manipulator', 'freebsd', '10.0', '10'
77
+ it_behaves_like 'a version manipulator', 'rhel', '6.5', '6'
78
+ it_behaves_like 'a version manipulator', 'el', '6.5', '6'
79
+ it_behaves_like 'a version manipulator', 'centos', '5.9.6', '5'
80
+ it_behaves_like 'a version manipulator', 'aix', '7.1', '7.1'
81
+ it_behaves_like 'a version manipulator', 'gentoo', '2004.3', '2004.3'
82
+ it_behaves_like 'a version manipulator', 'mac_os_x', '10.9.1', '10.9'
83
+ it_behaves_like 'a version manipulator', 'openbsd', '5.4.4', '5.4'
84
+ it_behaves_like 'a version manipulator', 'slackware', '12.0.1', '12.0'
85
+ it_behaves_like 'a version manipulator', 'solaris2', '5.9', '5.9'
86
+ it_behaves_like 'a version manipulator', 'suse', '5.9', '5.9'
87
+ it_behaves_like 'a version manipulator', 'omnios', 'r151010', 'r151010'
88
+ it_behaves_like 'a version manipulator', 'smartos', '20120809T221258Z', '20120809T221258Z'
89
+ it_behaves_like 'a version manipulator', 'windows', '5.0.2195', '2000'
90
+ it_behaves_like 'a version manipulator', 'windows', '5.1.2600', 'xp'
91
+ it_behaves_like 'a version manipulator', 'windows', '5.2.3790', '2003r2'
92
+ it_behaves_like 'a version manipulator', 'windows', '6.0.6001', '2008'
93
+ it_behaves_like 'a version manipulator', 'windows', '6.1.7600', '7'
94
+ it_behaves_like 'a version manipulator', 'windows', '6.1.7601', '2008r2'
95
+ it_behaves_like 'a version manipulator', 'windows', '6.2.9200', '8'
96
+ it_behaves_like 'a version manipulator', 'windows', '6.3.9200', '8.1'
97
+
98
+ context 'given an unknown platform' do
99
+ before do
100
+ stub_ohai(platform: 'ubuntu', version: '12.04') do |data|
101
+ data['platform'] = 'bacon'
102
+ data['platform_version'] = '1.crispy'
103
+ end
104
+ end
105
+
106
+ it 'raises an exception' do
107
+ expect { described_class.platform_version }
108
+ .to raise_error(UnknownPlatform)
109
+ end
110
+ end
111
+
112
+ context 'given an unknown windows platform version' do
113
+ before do
114
+ stub_ohai(platform: 'ubuntu', version: '12.04') do |data|
115
+ data['platform'] = 'windows'
116
+ data['platform_version'] = '1.2.3'
117
+ end
118
+ end
119
+
120
+ it 'raises an exception' do
121
+ expect { described_class.platform_version }
122
+ .to raise_error(UnknownPlatformVersion)
123
+ end
124
+ end
125
+ end
33
126
  end
34
127
 
35
128
  describe '.for_package' do
36
129
  it 'raises an exception when the file does not exist' do
37
- File.stub(:read).and_raise(Errno::ENOENT)
130
+ allow(File).to receive(:read).and_raise(Errno::ENOENT)
38
131
  expect { described_class.for_package(package) }
39
132
  .to raise_error(NoPackageMetadataFile)
40
133
  end
41
134
 
42
135
  it 'returns a metadata object' do
43
- File.stub(:read).and_return('{ "platform": "ubuntu" }')
136
+ allow(File).to receive(:read).and_return('{ "platform": "ubuntu" }')
44
137
  expect(described_class.for_package(package)).to be_a(described_class)
45
138
  end
46
139
 
47
140
  it 'loads the metadata from disk' do
48
- File.stub(:read).and_return('{ "platform": "ubuntu" }')
141
+ allow(File).to receive(:read).and_return('{ "platform": "ubuntu" }')
49
142
  instance = described_class.for_package(package)
50
143
 
51
144
  expect(instance[:platform]).to eq('ubuntu')
52
145
  end
146
+
147
+ it 'ensures an iteration exists' do
148
+ allow(File).to receive(:read).and_return('{}')
149
+ instance = described_class.for_package(package)
150
+
151
+ expect(instance[:iteration]).to eq(1)
152
+ end
153
+
154
+ it 'does not change existing iterations' do
155
+ allow(File).to receive(:read).and_return('{ "iteration": 4 }')
156
+ instance = described_class.for_package(package)
157
+
158
+ expect(instance[:iteration]).to eq(4)
159
+ end
53
160
  end
54
161
 
55
162
  describe '.path_for' do
@@ -75,7 +182,7 @@ module Omnibus
75
182
  describe '#save' do
76
183
  let(:file) { double(File) }
77
184
 
78
- before { File.stub(:open).and_yield(file) }
185
+ before { allow(File).to receive(:open).and_yield(file) }
79
186
 
80
187
  it 'saves the file to disk' do
81
188
  expect(file).to receive(:write).once
@@ -114,7 +221,7 @@ module Omnibus
114
221
  describe '#md5' do
115
222
  let(:md5) { 'abcdef123456' }
116
223
 
117
- before { subject.stub(:digest).with(path, :md5).and_return(md5) }
224
+ before { allow(subject).to receive(:digest).with(path, :md5).and_return(md5) }
118
225
 
119
226
  it 'returns the md5 of the package at the path' do
120
227
  expect(subject.md5).to eq(md5)
@@ -124,7 +231,7 @@ module Omnibus
124
231
  describe '#sha256' do
125
232
  let(:sha256) { 'abcdef123456' }
126
233
 
127
- before { subject.stub(:digest).with(path, :sha256).and_return(sha256) }
234
+ before { allow(subject).to receive(:digest).with(path, :sha256).and_return(sha256) }
128
235
 
129
236
  it 'returns the sha256 of the package at the path' do
130
237
  expect(subject.sha256).to eq(sha256)
@@ -134,7 +241,7 @@ module Omnibus
134
241
  describe '#sha512' do
135
242
  let(:sha512) { 'abcdef123456' }
136
243
 
137
- before { subject.stub(:digest).with(path, :sha512).and_return(sha512) }
244
+ before { allow(subject).to receive(:digest).with(path, :sha512).and_return(sha512) }
138
245
 
139
246
  it 'returns the sha512 of the package at the path' do
140
247
  expect(subject.sha512).to eq(sha512)
@@ -145,7 +252,7 @@ module Omnibus
145
252
  context 'when the file exists' do
146
253
  let(:content) { 'BINARY' }
147
254
 
148
- before { IO.stub(:read).with(path).and_return(content) }
255
+ before { allow(IO).to receive(:read).with(path).and_return(content) }
149
256
 
150
257
  it 'reads the file' do
151
258
  expect(subject.content).to eq(content)
@@ -153,7 +260,7 @@ module Omnibus
153
260
  end
154
261
 
155
262
  context 'when the file does not exist' do
156
- before { IO.stub(:read).and_raise(Errno::ENOENT) }
263
+ before { allow(IO).to receive(:read).and_raise(Errno::ENOENT) }
157
264
 
158
265
  it 'raises an exception' do
159
266
  expect { subject.content }.to raise_error(NoPackageFile)
@@ -164,7 +271,7 @@ module Omnibus
164
271
  describe '#metadata' do
165
272
  let(:content) { '{ "platform": "ubuntu" }' }
166
273
 
167
- before { IO.stub(:read).and_return(content) }
274
+ before { allow(IO).to receive(:read).and_return(content) }
168
275
 
169
276
  it 'returns a Metadata object' do
170
277
  expect(subject.metadata).to be_a(Package::Metadata)
@@ -68,7 +68,7 @@ module Omnibus
68
68
  end
69
69
 
70
70
  describe '#create_directory' do
71
- before { FileUtils.stub(:mkdir_p) }
71
+ before { allow(FileUtils).to receive(:mkdir_p) }
72
72
 
73
73
  it 'creates the directory' do
74
74
  expect(FileUtils).to receive(:mkdir_p).with('/foo/bar')
@@ -81,7 +81,7 @@ module Omnibus
81
81
  end
82
82
 
83
83
  describe '#remove_directory' do
84
- before { FileUtils.stub(:rm_rf) }
84
+ before { allow(FileUtils).to receive(:rm_rf) }
85
85
 
86
86
  it 'remove the directory' do
87
87
  expect(FileUtils).to receive(:rm_rf).with('/foo/bar')
@@ -91,8 +91,8 @@ module Omnibus
91
91
 
92
92
  describe '#purge_directory' do
93
93
  before do
94
- subject.stub(:remove_directory)
95
- subject.stub(:create_directory)
94
+ allow(subject).to receive(:remove_directory)
95
+ allow(subject).to receive(:create_directory)
96
96
  end
97
97
 
98
98
  it 'removes and creates the directory' do
@@ -103,7 +103,7 @@ module Omnibus
103
103
  end
104
104
 
105
105
  describe '#copy_file' do
106
- before { FileUtils.stub(:cp) }
106
+ before { allow(FileUtils).to receive(:cp) }
107
107
 
108
108
  it 'copies the file' do
109
109
  expect(FileUtils).to receive(:cp).with('foo', 'bar')
@@ -117,8 +117,8 @@ module Omnibus
117
117
 
118
118
  describe '#copy_directory' do
119
119
  before do
120
- FileUtils.stub(:cp_r)
121
- Dir.stub(:[]).and_return(['baz/file'])
120
+ allow(FileUtils).to receive(:cp_r)
121
+ allow(Dir).to receive(:[]).and_return(['baz/file'])
122
122
  end
123
123
 
124
124
  it 'copies the directory' do
@@ -141,8 +141,8 @@ module Omnibus
141
141
  input.write('<%= project.friendly_name %>')
142
142
  input.rewind
143
143
 
144
- File.stub(:open).with(source_path).and_yield(input)
145
- File.stub(:open).with(expected_destination_path, 'w').and_yield(output)
144
+ allow(File).to receive(:open).with(source_path).and_yield(input)
145
+ allow(File).to receive(:open).with(expected_destination_path, 'w').and_yield(output)
146
146
 
147
147
  expect(subject).to receive(:remove_file).with(source_path)
148
148
  end
@@ -171,7 +171,7 @@ module Omnibus
171
171
  end
172
172
 
173
173
  describe '#remove_file' do
174
- before { FileUtils.stub(:rm_f) }
174
+ before { allow(FileUtils).to receive(:rm_f) }
175
175
 
176
176
  it 'removes the file' do
177
177
  expect(FileUtils).to receive(:rm_f).with('/foo/bar')
@@ -180,7 +180,7 @@ module Omnibus
180
180
  end
181
181
 
182
182
  describe '#execute' do
183
- before { subject.stub(:shellout!) }
183
+ before { allow(subject).to receive(:shellout!) }
184
184
 
185
185
  it 'shellsout' do
186
186
  expect(subject).to receive(:shellout!)
@@ -191,17 +191,17 @@ module Omnibus
191
191
 
192
192
  describe '#assert_presence!' do
193
193
  it 'raises a MissingAsset exception when the file does not exist' do
194
- File.stub(:exist?).and_return(false)
194
+ allow(File).to receive(:exist?).and_return(false)
195
195
  expect { subject.assert_presence!('foo') }.to raise_error(MissingAsset)
196
196
  end
197
197
  end
198
198
 
199
199
  describe '#run!' do
200
200
  before do
201
- described_class.stub(:validate).and_return(proc {})
202
- described_class.stub(:setup).and_return(proc {})
203
- described_class.stub(:build).and_return(proc {})
204
- described_class.stub(:clean).and_return(proc {})
201
+ allow(described_class).to receive(:validate).and_return(proc {})
202
+ allow(described_class).to receive(:setup).and_return(proc {})
203
+ allow(described_class).to receive(:build).and_return(proc {})
204
+ allow(described_class).to receive(:clean).and_return(proc {})
205
205
  end
206
206
 
207
207
  it 'calls the methods in order' do
@@ -243,7 +243,7 @@ module Omnibus
243
243
  end
244
244
 
245
245
  context 'when project defines resources_path' do
246
- before { project.stub(:resources_path).and_return('project/specific') }
246
+ before { allow(project).to receive(:resources_path).and_return('project/specific') }
247
247
  it 'is the project resources_path, underscored_name, and Resources' do
248
248
  path = 'project/specific/base/Resources'
249
249
  expect(subject.send(:resources_path)).to eq(File.expand_path(path))