rake-builder 0.9.2 → 0.10.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,9 +2,9 @@ require 'spec_helper'
2
2
 
3
3
  describe Rake::Builder::LocalConfig do
4
4
  let(:local_config_file) { 'local_config' }
5
- let(:include_paths) { ['/foo/bar'] }
6
- let(:compilation_options) { ['foo', 'bar'] }
7
- let(:config_data) do
5
+ let(:include_paths) { [] }
6
+ let(:compilation_options) { [] }
7
+ let(:good_config_data) do
8
8
  {
9
9
  :rake_builder => {
10
10
  :config_file => {:version => '1.1'},
@@ -14,27 +14,28 @@ describe Rake::Builder::LocalConfig do
14
14
  }
15
15
  end
16
16
  let(:bad_config_data) do
17
- config_data[:rake_builder][:config_file][:version] = '0.1'
18
- config_data
17
+ config = good_config_data.clone
18
+ config[:rake_builder][:config_file][:version] = '0.1'
19
+ config
19
20
  end
21
+ let(:config_data) { good_config_data }
20
22
 
21
- before { YAML.stub(:load_file).and_return(config_data) }
23
+ before { allow(YAML).to receive(:load_file) { config_data } }
22
24
 
23
- subject { Rake::Builder::LocalConfig.new(local_config_file) }
25
+ subject { described_class.new(local_config_file) }
24
26
 
25
27
  context '#load' do
26
- it 'loads the file' do
27
- YAML.should_receive(:load_file).and_return(config_data)
28
+ let(:include_paths) { ['/foo/bar'] }
29
+ let(:compilation_options) { ['foo', 'bar'] }
28
30
 
29
- subject.load
30
- end
31
-
32
- it 'fails if the version is not recognized' do
33
- YAML.should_receive(:load_file).and_return(bad_config_data)
31
+ context 'if the version is not recognized' do
32
+ let(:config_data) { bad_config_data }
34
33
 
35
- expect {
36
- subject.load
37
- }.to raise_error(Rake::Builder::Error, /version incorrect/)
34
+ it 'fails' do
35
+ expect {
36
+ subject.load
37
+ }.to raise_error(Rake::Builder::Error, /version incorrect/)
38
+ end
38
39
  end
39
40
 
40
41
  it 'sets the include_paths' do
@@ -51,29 +52,17 @@ describe Rake::Builder::LocalConfig do
51
52
  end
52
53
 
53
54
  context '#save' do
54
- let(:file) { stub('File') }
55
+ let(:file) { double(File, write: nil) }
56
+ let(:data) { config_data.to_yaml }
55
57
 
56
58
  before do
57
- File.stub(:open).with(local_config_file, 'w') do |&block|
58
- block.call file
59
- end
59
+ allow(File).to receive(:open).with(local_config_file, 'w').and_yield(file)
60
60
  end
61
61
 
62
- it 'write to the file' do
63
- File.should_receive(:open).with(local_config_file, 'w') {}
64
-
62
+ it 'writes to the file' do
65
63
  subject.save
66
- end
67
64
 
68
- it 'saves the data' do
69
- expected = {
70
- :rake_builder => {:config_file => {:version => '1.1'}},
71
- :include_paths => [],
72
- :compilation_options => []
73
- }.to_yaml
74
- file.should_receive(:write).with(expected)
75
-
76
- subject.save
65
+ expect(file).to have_received(:write).with(data)
77
66
  end
78
67
  end
79
68
  end
@@ -46,9 +46,9 @@ describe Rake::Builder::Presenters::Makefile::BuilderPresenter do
46
46
  )
47
47
  end
48
48
 
49
- let(:executable_builder) { stub('Rake::Builder', executable_attributes) }
50
- let(:static_library_builder) { stub('Rake::Builder', static_library_attributes) }
51
- let(:shared_library_builder) { stub('Rake::Builder', shared_library_attributes) }
49
+ let(:executable_builder) { double(Rake::Builder, executable_attributes) }
50
+ let(:static_library_builder) { double('Rake::Builder', static_library_attributes) }
51
+ let(:shared_library_builder) { double('Rake::Builder', shared_library_attributes) }
52
52
 
53
53
  let(:executable_subject) { Rake::Builder::Presenters::Makefile::BuilderPresenter.new(executable_builder) }
54
54
  let(:static_library_subject) { Rake::Builder::Presenters::Makefile::BuilderPresenter.new(static_library_builder) }
@@ -66,12 +66,20 @@ describe Rake::Builder::Presenters::Makefile::BuilderPresenter do
66
66
  end
67
67
 
68
68
  context '#to_s' do
69
- it 'fails with unknown target types' do
70
- executable_builder.should_receive(:target_type).any_number_of_times.and_return(:foo)
69
+ context 'with unknown target types' do
70
+ let(:executable_attributes) do
71
+ common_attributes.merge(
72
+ :target => executable_target,
73
+ :target_type => :foo,
74
+ )
75
+ end
76
+
77
+ it 'fails' do
78
+ expect {
79
+ Rake::Builder::Presenters::Makefile::BuilderPresenter.new(executable_builder)
80
+ }.to raise_error(RuntimeError, /Unknown.*?target type/)
81
+ end
71
82
 
72
- expect {
73
- Rake::Builder::Presenters::Makefile::BuilderPresenter.new(executable_builder)
74
- }.to raise_error(RuntimeError, /Unknown.*?target type/)
75
83
  end
76
84
 
77
85
  context 'target' do
@@ -142,21 +150,16 @@ EOT
142
150
  end
143
151
 
144
152
  context '#save' do
145
- it 'creates the makefile' do
146
- File.should_receive(:open).with(makefile_name, 'w')
153
+ let(:file) { double(File, write: nil) }
147
154
 
148
- executable_subject.save
155
+ before do
156
+ allow(File).to receive(:open).with(makefile_name, 'w').and_yield(file)
149
157
  end
150
158
 
151
- it 'saves' do
152
- file = stub('File')
153
- File.stub(:open).with(makefile_name, 'w') do |&block|
154
- block.call file
155
- end
156
-
157
- file.should_receive(:write).with(/COMPILER.*?= the_compiler/)
158
-
159
+ it 'saves a makefile' do
159
160
  executable_subject.save
161
+
162
+ expect(file).to have_received(:write).with(/COMPILER.*?= the_compiler/)
160
163
  end
161
164
  end
162
165
  end
@@ -5,26 +5,22 @@ describe Rake::Builder::Presenters::MakefileAm::BuilderCollectionPresenter do
5
5
  it 'takes one parameter' do
6
6
  expect {
7
7
  Rake::Builder::Presenters::MakefileAm::BuilderCollectionPresenter.new
8
- }.to raise_error(ArgumentError, 'wrong number of arguments (0 for 1)')
8
+ }.to raise_error(ArgumentError, /wrong number of arguments/)
9
9
  end
10
10
  end
11
11
 
12
12
  context '#to_s' do
13
- let(:program_builder) { stub('Rake::Builder', :label => 'the_program', :target_path => 'the_program', :is_library? => false) }
14
- let(:library_builder) { stub('Rake::Builder', :label => 'the_library', :target_path => 'the_library', :is_library? => true) }
13
+ let(:program_builder) { double(Rake::Builder, :label => 'the_program', :target_path => 'the_program', :is_library? => false) }
14
+ let(:library_builder) { double(Rake::Builder, :label => 'the_library', :target_path => 'the_library', :is_library? => true) }
15
15
  let(:builders) { [program_builder, library_builder] }
16
16
 
17
- subject { Rake::Builder::Presenters::MakefileAm::BuilderCollectionPresenter.new(builders) }
17
+ subject { described_class.new(builders) }
18
18
 
19
19
  before do
20
- Rake::Builder::Presenters::MakefileAm::BuilderPresenter.
21
- stub(:new).
22
- with(program_builder).
23
- and_return("AAA\nBBB\n")
24
- Rake::Builder::Presenters::MakefileAm::BuilderPresenter.
25
- stub(:new).
26
- with(library_builder).
27
- and_return("XXX\nYYY\n")
20
+ allow(Rake::Builder::Presenters::MakefileAm::BuilderPresenter)
21
+ .to receive(:new).with(program_builder) { "AAA\nBBB\n" }
22
+ allow(Rake::Builder::Presenters::MakefileAm::BuilderPresenter)
23
+ .to receive(:new). with(library_builder) { "XXX\nYYY\n" }
28
24
  end
29
25
 
30
26
  it 'lists libraries' do
@@ -36,15 +32,6 @@ describe Rake::Builder::Presenters::MakefileAm::BuilderCollectionPresenter do
36
32
  end
37
33
 
38
34
  it 'includes builder text' do
39
- Rake::Builder::Presenters::MakefileAm::BuilderPresenter.
40
- should_receive(:new).
41
- with(program_builder).
42
- and_return("AAA\nBBB\n")
43
- Rake::Builder::Presenters::MakefileAm::BuilderPresenter.
44
- should_receive(:new).
45
- with(library_builder).
46
- and_return("XXX\nYYY\n")
47
-
48
35
  output = subject.to_s
49
36
 
50
37
  expect(output).to include("AAA\nBBB\n")
@@ -52,4 +39,3 @@ describe Rake::Builder::Presenters::MakefileAm::BuilderCollectionPresenter do
52
39
  end
53
40
  end
54
41
  end
55
-
@@ -4,33 +4,26 @@ describe Rake::Builder::Presenters::MakefileAm::BuilderPresenter do
4
4
  context '.new' do
5
5
  it 'takes one parameter' do
6
6
  expect {
7
- Rake::Builder::Presenters::MakefileAm::BuilderPresenter.new
8
- }.to raise_error(ArgumentError, 'wrong number of arguments (0 for 1)')
7
+ described_class.new
8
+ }.to raise_error(ArgumentError, /wrong number of arguments/)
9
9
  end
10
10
  end
11
11
 
12
12
  context '#to_s' do
13
13
  let(:builder) do
14
- stub(
15
- 'Rake::Builder',
16
- :is_library? => false,
17
- :label => 'fubar',
18
- :source_files => ['path/to/1', 'path/to/2'],
19
- :compiler_flags => '-D FOO -D BAR',
20
- :library_dependencies_list => '-lfoo -lbar'
14
+ double(
15
+ Rake::Builder,
16
+ is_library?: is_library?,
17
+ label: 'fubar',
18
+ source_files: ['path/to/1', 'path/to/2'],
19
+ compiler_flags: '-D FOO -D BAR',
20
+ library_dependencies_list: library_dependencies_list
21
21
  )
22
22
  end
23
- let(:library) do
24
- builder.stub(:is_library? => true)
25
- builder.stub(:library_dependencies_list => [])
26
- builder
27
- end
28
- let(:binary) do
29
- builder.stub(:is_library? => false)
30
- builder
31
- end
23
+ let(:library_dependencies_list) { [] }
24
+ let(:is_library?) { true }
32
25
 
33
- subject { Rake::Builder::Presenters::MakefileAm::BuilderPresenter.new(builder) }
26
+ subject { described_class.new(builder) }
34
27
 
35
28
  it 'lists sources' do
36
29
  sources_match = %r(fubar_SOURCES\s+=\s+path/to/1 path/to/2)
@@ -46,8 +39,6 @@ describe Rake::Builder::Presenters::MakefileAm::BuilderPresenter do
46
39
  end
47
40
 
48
41
  context 'library builder' do
49
- subject { Rake::Builder::Presenters::MakefileAm::BuilderPresenter.new(library) }
50
-
51
42
  it "doesn't show ld flags" do
52
43
  expect(subject.to_s).to_not include('fubar_LDFLAGS')
53
44
  end
@@ -58,7 +49,8 @@ describe Rake::Builder::Presenters::MakefileAm::BuilderPresenter do
58
49
  end
59
50
 
60
51
  context 'executable builder' do
61
- subject { Rake::Builder::Presenters::MakefileAm::BuilderPresenter.new(binary) }
52
+ let(:is_library?) { false }
53
+ let(:library_dependencies_list) { '-lfoo -lbar' }
62
54
 
63
55
  it 'shows ld flags' do
64
56
  expect(subject.to_s).to match(%r(fubar_LDFLAGS\s+=\s+-L))
@@ -70,4 +62,3 @@ describe Rake::Builder::Presenters::MakefileAm::BuilderPresenter do
70
62
  end
71
63
  end
72
64
  end
73
-
@@ -2,30 +2,39 @@ require 'spec_helper'
2
2
 
3
3
  describe Rake::Builder::BuilderCollectionTaskDefiner do
4
4
  context '#run' do
5
- subject { Rake::Builder::BuilderCollectionTaskDefiner.new }
5
+ let(:builder) do
6
+ double(
7
+ Rake::Builder,
8
+ source_files: ['foo'],
9
+ rakefile_path: '/path',
10
+ is_library?: false,
11
+ target_path: '/path2',
12
+ label: 'path2',
13
+ compiler_flags: [],
14
+ library_dependencies_list: [],
15
+ )
16
+ end
17
+ let(:params) { ['foo', '1.11.1111'] }
6
18
 
7
19
  before do
8
20
  Rake::Task.clear
21
+ allow(Rake::Builder).to receive(:create_autoconf)
9
22
  end
10
23
 
11
24
  it 'defines an autoconf task' do
12
25
  subject.run
13
26
 
14
- expect(Rake::Task.task_defined?('autoconf')).to be_true
27
+ expect(Rake::Task.task_defined?('autoconf')).to be_truthy
15
28
  end
16
29
 
17
30
  it 'calls create_autoconf' do
18
- Rake::Builder.instances << stub(
19
- 'Rake::Builder',
20
- :source_files => ['foo'],
21
- :rakefile_path => '/path',
22
- )
31
+ Rake::Builder.instances << builder
23
32
 
24
33
  subject.run
25
34
 
26
- Rake::Builder.should_receive(:create_autoconf)
35
+ Rake::Task['autoconf'].invoke(*params)
27
36
 
28
- Rake::Task['autoconf'].invoke
37
+ expect(Rake::Builder).to have_received(:create_autoconf)
29
38
  end
30
39
 
31
40
  it 'fails if no builders have been instantiated' do
@@ -34,7 +43,7 @@ describe Rake::Builder::BuilderCollectionTaskDefiner do
34
43
  subject.run
35
44
 
36
45
  expect {
37
- Rake::Task['autoconf'].invoke
46
+ Rake::Task['autoconf'].invoke(*params)
38
47
  }.to raise_error(RuntimeError, 'No Rake::Builder projects have been defined')
39
48
  end
40
49
  end
@@ -44,41 +44,48 @@ describe Rake::Builder::BuilderTaskDefiner do
44
44
  let(:executable_target) { self.class.executable_target }
45
45
  let(:objects_path) { self.class.objects_path }
46
46
  let(:custom_prerequisite) { self.class.custom_prerequisite }
47
- let(:logger) { stub('Logger') }
47
+ let(:logger) { double(Logger, :'level=' => nil) }
48
48
  let(:builder) do
49
- stub(
50
- 'Rake::Builder',
51
- :task_namespace => nil,
52
- :target_type => :executable,
53
- :target => executable_target,
54
- :target_basename => executable_target,
55
- :target_prerequisites => [custom_prerequisite],
56
- :makedepend_file => self.class.makedepend_file,
57
- :source_files => self.class.source_files,
58
- :object_files => self.class.object_files,
59
- :object_path => self.class.object_files[0],
60
- :objects_path => objects_path,
61
- :generated_files => [],
62
- :local_config => self.class.local_config,
63
- :generated_headers => self.class.generated_headers,
64
- :install_path => 'install/path',
65
- :makefile_name => self.class.makefile_name,
66
- :default_task => :build,
67
- :logger => logger,
49
+ double(
50
+ Rake::Builder,
51
+ task_namespace: task_namespace,
52
+ target_type: :executable,
53
+ target: executable_target,
54
+ target_basename: executable_target,
55
+ target_prerequisites: [custom_prerequisite],
56
+ makedepend_file: self.class.makedepend_file,
57
+ source_files: self.class.source_files,
58
+ object_files: self.class.object_files,
59
+ object_path: self.class.object_files[0],
60
+ objects_path: objects_path,
61
+ generated_files: [],
62
+ local_config: self.class.local_config,
63
+ generated_headers: self.class.generated_headers,
64
+ install_path: 'install/path',
65
+ makefile_name: self.class.makefile_name,
66
+ default_task: :build,
67
+ logger: logger,
68
68
  )
69
69
  end
70
- let(:namespaced_builder) { builder.stub(:task_namespace => 'foo'); builder }
70
+ let(:task_namespace) { nil }
71
71
 
72
- subject { Rake::Builder::BuilderTaskDefiner.new(builder) }
72
+ subject { described_class.new(builder) }
73
73
 
74
74
  before do
75
75
  Rake::Task.clear
76
+ %w(
77
+ run clean build install uninstall compile
78
+ create_makedepend_file create_local_config ensure_headers
79
+ load_local_config
80
+ ).each do |m|
81
+ allow(builder).to receive(m.intern)
82
+ end
76
83
  end
77
84
 
78
85
  context '#new' do
79
86
  it 'takes a parameter' do
80
87
  expect {
81
- Rake::Builder::BuilderTaskDefiner.new
88
+ described_class.new
82
89
  }.to raise_error(ArgumentError)
83
90
  end
84
91
  end
@@ -105,7 +112,7 @@ describe Rake::Builder::BuilderTaskDefiner do
105
112
  it "defines '#{task}'" do
106
113
  subject.run
107
114
 
108
- expect(Rake::Task.task_defined?(task)).to be_true
115
+ expect(Rake::Task.task_defined?(task)).to be_truthy
109
116
  end
110
117
  end
111
118
 
@@ -113,36 +120,36 @@ describe Rake::Builder::BuilderTaskDefiner do
113
120
  it 'defines run' do
114
121
  subject.run
115
122
 
116
- expect(Rake::Task.task_defined?('run')).to be_true
123
+ expect(Rake::Task.task_defined?('run')).to be_truthy
117
124
  end
118
125
  end
119
126
 
120
127
  context 'with a namespace' do
121
- subject { Rake::Builder::BuilderTaskDefiner.new(namespaced_builder) }
128
+ let(:task_namespace) { 'foo' }
122
129
 
123
130
  it 'namespaces tasks' do
124
131
  subject.run
125
132
 
126
- expect(Rake::Task.task_defined?('foo:run')).to be_true
133
+ expect(Rake::Task.task_defined?('foo:run')).to be_truthy
127
134
  end
128
135
 
129
136
  it 'defines the namespace default task' do
130
137
  subject.run
131
138
 
132
- expect(Rake::Task.task_defined?('foo')).to be_true
139
+ expect(Rake::Task.task_defined?('foo')).to be_truthy
133
140
  end
134
141
 
135
142
  it 'does not fiddle up the local_config file' do
136
143
  subject.run
137
144
 
138
- expect(Rake::Task['foo:load_local_config'].prerequisites).to eq([namespaced_builder.local_config])
145
+ expect(Rake::Task['foo:load_local_config'].prerequisites).to eq([builder.local_config])
139
146
  end
140
147
  end
141
148
  end
142
149
 
143
150
  context 'dependencies' do
144
151
  before do
145
- Rake::Builder::BuilderTaskDefiner.new(builder).run
152
+ described_class.new(builder).run
146
153
  end
147
154
 
148
155
  [
@@ -177,52 +184,25 @@ describe Rake::Builder::BuilderTaskDefiner do
177
184
 
178
185
  context 'tasks' do
179
186
  before do
180
- Rake::Builder::BuilderTaskDefiner.new(builder).run
181
- end
182
-
183
- context 'run' do
184
- it 'runs the builder' do
185
- clear_prerequisites 'run'
186
-
187
- builder.should_receive(:run)
188
-
189
- Rake::Task['run'].invoke
190
- end
191
- end
192
-
193
- context 'the target' do
194
- it 'builds the target' do
195
- clear_prerequisites executable_target
196
-
197
- builder.should_receive(:build)
198
-
199
- Rake::Task[executable_target].invoke
200
- end
201
- end
202
-
203
- context 'clean' do
204
- it 'cleans the build' do
205
- builder.should_receive(:clean)
206
-
207
- Rake::Task['clean'].invoke
208
- end
209
- end
210
-
211
- context 'install' do
212
- it 'installs the target' do
213
- clear_prerequisites 'install'
214
-
215
- builder.should_receive(:install)
216
-
217
- Rake::Task['install'].invoke
218
- end
187
+ described_class.new(builder).run
219
188
  end
220
189
 
221
- context 'uninstall' do
222
- it 'uninstalls the target' do
223
- builder.should_receive(:uninstall)
224
-
225
- Rake::Task['uninstall'].invoke
190
+ [
191
+ ['run', 'runs the builder', :run],
192
+ [executable_target, 'builds the target', :build],
193
+ ['clean', 'cleans the build', :clean],
194
+ ['install', 'installs the target', :install],
195
+ ['uninstall', 'uninstalls the target', :uninstall],
196
+ ['load_local_config', 'loads local config', :load_local_config],
197
+ ].each do |task, action, command|
198
+ context task do
199
+ it action do
200
+ clear_prerequisites task
201
+
202
+ Rake::Task[task].invoke
203
+
204
+ expect(builder).to have_received(command)
205
+ end
226
206
  end
227
207
  end
228
208
 
@@ -230,28 +210,19 @@ describe Rake::Builder::BuilderTaskDefiner do
230
210
  it 'compiles the file' do
231
211
  clear_prerequisites 'src/file1.o'
232
212
 
233
- builder.should_receive(:compile).
234
- with('src/file1.cpp', 'src/file1.o')
235
-
236
213
  Rake::Task['src/file1.o'].invoke
214
+
215
+
216
+ expect(builder).to have_received(:compile).
217
+ with('src/file1.cpp', 'src/file1.o')
237
218
  end
238
219
  end
239
220
 
240
221
  context 'local_config' do
241
222
  it 'creates local config' do
242
- builder.should_receive(:create_local_config)
243
-
244
223
  Rake::Task[self.class.local_config].invoke
245
- end
246
- end
247
224
 
248
- context 'load_local_config' do
249
- it 'loads local config' do
250
- clear_prerequisites 'load_local_config'
251
-
252
- builder.should_receive(:load_local_config)
253
-
254
- Rake::Task['load_local_config'].invoke
225
+ expect(builder).to have_received(:create_local_config)
255
226
  end
256
227
  end
257
228
 
@@ -261,17 +232,17 @@ describe Rake::Builder::BuilderTaskDefiner do
261
232
  end
262
233
 
263
234
  it 'calls ensure_headers' do
264
- builder.should_receive(:ensure_headers)
265
-
266
235
  Rake::Task['missing_headers'].invoke
236
+
237
+ expect(builder).to have_received(:ensure_headers)
267
238
  end
268
239
 
269
240
  it 'fails if builder raises an error' do
270
- builder.stub(:ensure_headers).and_raise('foo')
241
+ allow(builder).to receive(:ensure_headers).and_raise('foo')
271
242
 
272
243
  expect {
273
244
  Rake::Task['missing_headers'].invoke
274
- }.to raise_error
245
+ }.to raise_error(RuntimeError, /foo/)
275
246
  end
276
247
  end
277
248
 
@@ -279,9 +250,9 @@ describe Rake::Builder::BuilderTaskDefiner do
279
250
  it 'creates the makedepend file' do
280
251
  clear_prerequisites self.class.makedepend_file
281
252
 
282
- builder.should_receive(:create_makedepend_file)
283
-
284
253
  Rake::Task[self.class.makedepend_file].invoke
254
+
255
+ expect(builder).to have_received(:create_makedepend_file)
285
256
  end
286
257
  end
287
258
 
@@ -289,13 +260,7 @@ describe Rake::Builder::BuilderTaskDefiner do
289
260
  before do
290
261
  clear_prerequisites 'load_makedepend'
291
262
  @object_file = self.class.object_files[0]
292
- builder.stub(:load_makedepend).and_return({@object_file => ['include/header1.h']})
293
- end
294
-
295
- it 'gets dependency information from builder' do
296
- builder.should_receive(:load_makedepend).and_return({@object_file => ['include/header1.h']})
297
-
298
- Rake::Task['load_makedepend'].invoke
263
+ allow(builder).to receive(:load_makedepend) { {@object_file => ['include/header1.h']} }
299
264
  end
300
265
 
301
266
  it 'creates tasks for headers' do
@@ -312,18 +277,20 @@ describe Rake::Builder::BuilderTaskDefiner do
312
277
  end
313
278
 
314
279
  context 'makefile' do
315
- let(:presenter) { stub('BuilderPresenter') }
280
+ let(:presenter) do
281
+ double(Rake::Builder::Presenters::Makefile::BuilderPresenter, save: nil)
282
+ end
283
+
284
+ before do
285
+ allow(Rake::Builder::Presenters::Makefile::BuilderPresenter).to receive(:new).with(builder) { presenter }
286
+ end
316
287
 
317
288
  it 'creates a makefile' do
318
289
  clear_prerequisites self.class.makefile_name
319
290
 
320
- Rake::Builder::Presenters::Makefile::BuilderPresenter.
321
- should_receive(:new).
322
- with(builder).
323
- and_return(presenter)
324
- presenter.should_receive(:save)
325
-
326
291
  Rake::Task[self.class.makefile_name].invoke
292
+
293
+ expect(presenter).to have_received(:save)
327
294
  end
328
295
  end
329
296
 
@@ -331,9 +298,9 @@ describe Rake::Builder::BuilderTaskDefiner do
331
298
  it 'sets the logger level if required' do
332
299
  ENV['DEBUG'] = 'true'
333
300
 
334
- logger.should_receive(:level=).with(0)
335
-
336
301
  Rake::Task['environment'].invoke
302
+
303
+ expect(logger).to have_received(:level=).with(0)
337
304
  end
338
305
  end
339
306
  end