rake-funnel 0.1.0.pre → 0.2.0.pre

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 (43) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rake/funnel/integration/teamcity/nunit_plugin.rb +3 -7
  3. data/lib/rake/funnel/support/binary_version_reader.rb +32 -0
  4. data/lib/rake/funnel/support/copier.rb +27 -0
  5. data/lib/rake/funnel/support/msbuild/build_tool.rb +13 -17
  6. data/lib/rake/funnel/support/{side_by_side_specs/remover.rb → specs_remover.rb} +2 -2
  7. data/lib/rake/funnel/support/zipper.rb +49 -0
  8. data/lib/rake/funnel/tasks/assembly_version.rb +17 -11
  9. data/lib/rake/funnel/tasks/bin_path.rb +17 -10
  10. data/lib/rake/funnel/tasks/copy.rb +13 -30
  11. data/lib/rake/funnel/tasks/environments.rb +36 -23
  12. data/lib/rake/funnel/tasks/msbuild.rb +21 -21
  13. data/lib/rake/funnel/tasks/msdeploy.rb +17 -24
  14. data/lib/rake/funnel/tasks/nunit.rb +17 -17
  15. data/lib/rake/funnel/tasks/paket.rb +15 -9
  16. data/lib/rake/funnel/tasks/quick_template.rb +14 -12
  17. data/lib/rake/funnel/tasks/side_by_side_specs.rb +16 -10
  18. data/lib/rake/funnel/tasks/timing.rb +16 -9
  19. data/lib/rake/funnel/tasks/zip.rb +14 -48
  20. data/lib/rake/funnel/version.rb +1 -1
  21. data/spec/rake/funnel/integration/teamcity/nunit_plugin_spec.rb +16 -18
  22. data/spec/rake/funnel/support/binary_version_reader_spec.rb +29 -0
  23. data/spec/rake/funnel/support/copier_spec.rb +58 -0
  24. data/spec/rake/funnel/support/{side_by_side_specs/example → specs_remover}/FooCode.cs +0 -0
  25. data/spec/rake/funnel/support/{side_by_side_specs/example → specs_remover}/FooSpecs.cs +0 -0
  26. data/spec/rake/funnel/support/{side_by_side_specs/example → specs_remover}/Sample.csproj +0 -0
  27. data/spec/rake/funnel/support/{side_by_side_specs/example → specs_remover}/Specs.cs +0 -0
  28. data/spec/rake/funnel/support/{side_by_side_specs/example → specs_remover}/subdir/BarCode.cs +0 -0
  29. data/spec/rake/funnel/support/{side_by_side_specs/example → specs_remover}/subdir/BarSpecs.cs +0 -0
  30. data/spec/rake/funnel/support/{side_by_side_specs/remover_spec.rb → specs_remover_spec.rb} +2 -2
  31. data/spec/rake/funnel/support/zipper_spec.rb +77 -0
  32. data/spec/rake/funnel/tasks/assembly_version_spec.rb +10 -19
  33. data/spec/rake/funnel/tasks/bin_path_spec.rb +19 -7
  34. data/spec/rake/funnel/tasks/copy_spec.rb +18 -73
  35. data/spec/rake/funnel/tasks/environments_spec.rb +59 -105
  36. data/spec/rake/funnel/tasks/msbuild_spec.rb +30 -30
  37. data/spec/rake/funnel/tasks/msdeploy_spec.rb +0 -23
  38. data/spec/rake/funnel/tasks/nunit_spec.rb +11 -13
  39. data/spec/rake/funnel/tasks/paket_spec.rb +3 -45
  40. data/spec/rake/funnel/tasks/quick_template_spec.rb +0 -27
  41. data/spec/rake/funnel/tasks/side_by_side_specs_spec.rb +3 -4
  42. data/spec/rake/funnel/tasks/zip_spec.rb +21 -101
  43. metadata +26 -17
@@ -3,7 +3,6 @@ include Rake::Funnel::Support
3
3
 
4
4
  describe Rake::Funnel::Tasks::Copy do
5
5
  before {
6
- CLEAN.clear
7
6
  Task.clear
8
7
  }
9
8
 
@@ -11,89 +10,35 @@ describe Rake::Funnel::Tasks::Copy do
11
10
  its(:name) { should == :copy }
12
11
  its(:source) { should eq([]) }
13
12
  its(:target) { should be_nil }
14
-
15
- it 'should not add the target file to the files to be cleaned' do
16
- expect(CLEAN).to be_empty
17
- end
18
-
19
- describe 'overriding defaults' do
20
- subject {
21
- described_class.new do |t|
22
- t.target = 'something'
23
- end
24
- }
25
-
26
- it 'should add the target file to the files to be cleaned' do
27
- expect(CLEAN).to include(subject.target)
28
- end
29
- end
30
13
  end
31
14
 
32
15
  describe 'execution' do
33
- let(:source) { %w(bin/1 bin/2 bin/3/4 bin/directory/file bin/directory bin/directory-no-content) }
34
- let(:target) { 'some path' }
16
+ let(:source) { %w(one two) }
17
+ let(:target) { 'target' }
18
+ let(:finder) { instance_double(Finder).as_null_object }
35
19
 
36
- subject! {
20
+ before {
21
+ allow(finder).to receive(:all_or_default).and_return(source)
22
+ allow(Finder).to receive(:new).and_return(finder)
23
+ }
24
+
25
+ before {
26
+ allow(Copier).to receive(:copy)
27
+ }
28
+
29
+ subject {
37
30
  described_class.new do |t|
38
31
  t.source = source
39
32
  t.target = target
40
33
  end
41
34
  }
42
35
 
43
- context 'failure' do
44
- context 'target not defined' do
45
- let(:target) { nil }
46
-
47
- it 'should fail' do
48
- expect { Task[subject.name].invoke }.to raise_error(/Target not defined/)
49
- end
50
- end
51
- end
52
-
53
- context 'success' do
54
- let(:finder) { double(Finder).as_null_object }
55
-
56
- before {
57
- allow(finder).to receive(:all_or_default).and_return(source)
58
- allow(Finder).to receive(:new).and_return(finder)
59
-
60
- allow(File).to receive(:directory?).and_return(false)
61
- source.last(2).each do |dir|
62
- allow(File).to receive(:directory?).with(dir).and_return(true)
63
- end
64
-
65
- allow(RakeFileUtils).to receive(:mkdir_p)
66
- allow(RakeFileUtils).to receive(:cp)
67
- }
68
-
69
- before {
70
- Task[subject.name].invoke
71
- }
72
-
73
- def no_prefix(file)
74
- file.sub(%r|bin/|, '')
75
- end
76
-
77
- it 'should create target directories' do
78
- expect(RakeFileUtils).to have_received(:mkdir_p).with(subject.target + '/3')
79
- expect(RakeFileUtils).to have_received(:mkdir_p).with(subject.target + '/directory')
80
- end
81
-
82
- it 'should skip source directories' do
83
- source
84
- .select { |src| File.directory?(src) }
85
- .each do |src|
86
- expect(RakeFileUtils).not_to have_received(:cp).with(src, anything)
87
- end
88
- end
36
+ before {
37
+ Task[subject.name].invoke
38
+ }
89
39
 
90
- it 'should copy files with common path removed' do
91
- source
92
- .select { |src| !File.directory?(src) }
93
- .each do |src|
94
- expect(RakeFileUtils).to have_received(:cp).with(src, File.join(subject.target, no_prefix(src)), { preserve: true })
95
- end
96
- end
40
+ it 'should delegate to Copier' do
41
+ expect(Copier).to have_received(:copy).with(source, subject.target)
97
42
  end
98
43
  end
99
44
  end
@@ -1,3 +1,5 @@
1
+ require 'configatron'
2
+
1
3
  include Rake
2
4
  include Rake::Funnel::Support::Environments
3
5
  include Rake::Funnel::Tasks
@@ -9,14 +11,6 @@ describe Rake::Funnel::Tasks::Environments do
9
11
  Task.clear
10
12
  }
11
13
 
12
- before {
13
- module Kernel
14
- def configatron
15
- OpenStruct.new(name: 'fake configatron singleton')
16
- end
17
- end
18
- }
19
-
20
14
  let(:files) { [] }
21
15
 
22
16
  before {
@@ -32,6 +26,7 @@ describe Rake::Funnel::Tasks::Environments do
32
26
  disable_default_env_setup
33
27
  }
34
28
 
29
+ its(:store) { should == configatron }
35
30
  its(:base_dir) { should == 'config' }
36
31
  its(:default_env) { should be_nil }
37
32
  its(:default_config) { should == 'default' }
@@ -39,8 +34,11 @@ describe Rake::Funnel::Tasks::Environments do
39
34
  its(:customizer) { should be_nil }
40
35
 
41
36
  describe 'overriding defaults' do
37
+ let(:store) { OpenStruct.new }
38
+
42
39
  subject {
43
40
  described_class.new do |t|
41
+ t.store = store
44
42
  t.base_dir = 'custom base_dir'
45
43
  t.default_env = 'custom default_env'
46
44
  t.default_config = 'custom default_config'
@@ -49,6 +47,7 @@ describe Rake::Funnel::Tasks::Environments do
49
47
  end
50
48
  }
51
49
 
50
+ its(:store) { should == store }
52
51
  its(:base_dir) { should == subject.base_dir }
53
52
  its(:default_env) { should == subject.default_env }
54
53
  its(:default_config) { should == subject.default_config }
@@ -85,6 +84,7 @@ describe Rake::Funnel::Tasks::Environments do
85
84
  end
86
85
 
87
86
  describe 'config files to load' do
87
+ let(:optional) { nil }
88
88
  let(:files) {
89
89
  %w(config/dev.yaml)
90
90
  }
@@ -98,16 +98,20 @@ describe Rake::Funnel::Tasks::Environments do
98
98
  allow(File).to receive(:exists?).with(optional).and_return(false)
99
99
  }
100
100
 
101
- subject {
101
+ subject! {
102
102
  described_class.new do |t|
103
103
  t.default_env = 'dev'
104
104
  end
105
105
  }
106
106
 
107
107
  before {
108
- expect(subject).to be
108
+ Task['dev'].invoke
109
109
  }
110
110
 
111
+ it 'should store configuration in configatron singleton' do
112
+ expect(Loader).to have_received(:load_configuration).with(anything, configatron, any_args)
113
+ end
114
+
111
115
  context 'default and local config files exist' do
112
116
  let(:optional) { nil }
113
117
 
@@ -136,32 +140,13 @@ describe Rake::Funnel::Tasks::Environments do
136
140
  end
137
141
  end
138
142
 
139
- describe 'store' do
140
- let(:files) {
141
- %w(config/dev.yaml)
142
- }
143
-
144
- before {
145
- allow(Loader).to receive(:load_configuration)
146
- }
147
-
148
- before {
149
- expect(subject).to be
150
- Task['dev'].invoke
151
- }
152
-
153
- it 'should store configuration in configatron singleton' do
154
- expect(Loader).to have_received(:load_configuration).with(anything, configatron, any_args)
155
- end
156
- end
157
-
158
143
  describe 'customization' do
159
144
  let(:customizer) { Proc.new {} }
160
145
  let(:files) {
161
146
  %w(config/dev.yaml)
162
147
  }
163
148
 
164
- subject {
149
+ subject! {
165
150
  described_class.new do |t|
166
151
  t.customizer = customizer
167
152
  end
@@ -172,7 +157,6 @@ describe Rake::Funnel::Tasks::Environments do
172
157
  }
173
158
 
174
159
  before {
175
- expect(subject).to be
176
160
  Task['dev'].invoke
177
161
  }
178
162
 
@@ -187,104 +171,74 @@ describe Rake::Funnel::Tasks::Environments do
187
171
  }
188
172
 
189
173
  before {
190
- allow(Loader).to receive(:load_configuration)
174
+ Rake.application.top_level_tasks.clear
175
+ Rake.application.top_level_tasks.push(*top_level_tasks)
191
176
  }
192
177
 
193
- context 'no default environment configured' do
194
- before {
195
- expect(subject).to be
196
- }
197
-
198
- it 'should not invoke environment tasks' do
199
- expect(Loader).not_to have_received(:load_configuration)
200
- end
201
- end
202
-
203
- context 'default environment configured' do
204
- subject {
178
+ context 'environment task defined in top-level Rake namespace' do
179
+ subject! {
205
180
  described_class.new do |t|
206
- t.default_env = 'dev'
181
+ t.default_env = default_env
207
182
  end
208
183
  }
209
184
 
210
- before {
211
- allow(Rake.application).to receive(:top_level_tasks).and_return(user_defined_task)
212
- }
213
-
214
- before {
215
- expect(subject).to be
216
- }
217
-
218
- context 'no user-defined environment' do
219
- let(:user_defined_task) { %w(foo) }
220
-
221
- it 'should invoke default environment task' do
222
- expect(Loader)
223
- .to have_received(:load_configuration).with(hash_including({ name: 'dev' }), any_args)
224
- end
185
+ context 'no default environment configured' do
186
+ let(:default_env) { nil }
187
+ let(:top_level_tasks) { [] }
225
188
 
226
- it 'should not invoke other environment tasks' do
227
- expect(Loader)
228
- .not_to have_received(:load_configuration).with(hash_including({ name: 'production' }), any_args)
189
+ it 'should not add top-level environment tasks' do
190
+ expect(Rake.application.top_level_tasks).to be_empty
229
191
  end
230
192
  end
231
193
 
232
- context 'user-defined environment' do
233
- let(:user_defined_task) { %w(foo production) }
194
+ context 'default environment configured' do
195
+ let(:default_env) { 'dev' }
234
196
 
235
- it 'should invoke user-defined environment task' do
236
- expect(Loader)
237
- .to have_received(:load_configuration).with(hash_including({ name: 'production' }), any_args)
197
+ context 'no top-level environment task' do
198
+ let(:top_level_tasks) { %w(foo) }
199
+
200
+ it 'should prepend default top-level environment task' do
201
+ expect(Rake.application.top_level_tasks).to eq([default_env] + top_level_tasks)
202
+ end
238
203
  end
239
204
 
240
- it 'should not invoke other environment tasks' do
241
- expect(Loader)
242
- .not_to have_received(:load_configuration).with(hash_including({ name: 'dev' }), any_args)
205
+ context 'top-level environment task' do
206
+ let(:top_level_tasks) { %w(foo production) }
207
+
208
+ it 'should move top-level environment task to front' do
209
+ expect(Rake.application.top_level_tasks).to eq(top_level_tasks.reverse)
210
+ end
243
211
  end
244
212
  end
213
+ end
245
214
 
246
- context 'environment task defined in Rake namespace' do
247
- subject {
248
- namespace :foo do
249
- namespace :bar do
250
- described_class.new do |t|
251
- t.default_env = 'dev'
252
- end
215
+ context 'environment task defined in Rake namespace' do
216
+ subject! {
217
+ namespace :foo do
218
+ namespace :bar do
219
+ described_class.new do |t|
220
+ t.default_env = default_env
253
221
  end
254
222
  end
255
- }
256
-
257
- context 'default environment configured' do
258
- before {
259
- expect(subject).to be
260
- }
223
+ end
224
+ }
261
225
 
262
- context 'no user-defined environment' do
263
- let(:user_defined_task) { %w(foo) }
226
+ context 'default environment configured' do
227
+ let(:default_env) { 'dev' }
264
228
 
265
- it 'should invoke default environment task' do
266
- expect(Loader)
267
- .to have_received(:load_configuration).with(hash_including({ name: 'dev' }), any_args)
268
- end
229
+ context 'no top-level environment task' do
230
+ let(:top_level_tasks) { %w(foo) }
269
231
 
270
- it 'should not invoke other environment tasks' do
271
- expect(Loader)
272
- .not_to have_received(:load_configuration).with(hash_including({ name: 'production' }), any_args)
273
- end
232
+ it 'should prepend default top-level environment task' do
233
+ expect(Rake.application.top_level_tasks).to eq(["foo:bar:#{default_env}"] + top_level_tasks)
274
234
  end
235
+ end
275
236
 
276
- context 'user-defined environment' do
277
- let(:user_defined_task) { %w(foo foo:bar:production) }
278
-
279
- it 'should invoke user-defined environment task' do
280
- expect(Loader)
281
- .to have_received(:load_configuration).with(hash_including({ name: 'production' }), any_args)
282
- end
237
+ context 'top-level environment task' do
238
+ let(:top_level_tasks) { %w(foo foo:bar:production) }
283
239
 
284
- it 'should not invoke other environment tasks' do
285
- expect(Loader)
286
- .not_to have_received(:load_configuration).with(hash_including({ name: 'dev' }), any_args)
287
- end
240
+ it 'should move top-level environment task to front' do
241
+ expect(Rake.application.top_level_tasks).to eq(top_level_tasks.reverse)
288
242
  end
289
243
  end
290
244
  end
@@ -25,36 +25,6 @@ describe Rake::Funnel::Tasks::MSBuild do
25
25
  end
26
26
  end
27
27
 
28
- describe 'overriding defaults' do
29
- context 'when msbuild executable is specified' do
30
- subject {
31
- described_class.new do |t|
32
- t.msbuild = 'custom build tool.exe'
33
- end
34
- }
35
-
36
- its(:msbuild) { should == 'custom build tool.exe' }
37
- end
38
-
39
- context 'when project or solution is specified' do
40
- before {
41
- allow(Finder).to receive(:new).and_call_original
42
- }
43
-
44
- subject {
45
- described_class.new do |t|
46
- t.project_or_solution = 'project.sln'
47
- end
48
- }
49
-
50
- its(:project_or_solution) { should be_instance_of(Finder) }
51
-
52
- it 'should set project or solution' do
53
- expect(Finder).to have_received(:new).with('project.sln', subject, 'No projects or more than one project found.')
54
- end
55
- end
56
- end
57
-
58
28
  describe 'execution' do
59
29
  let(:args) { {} }
60
30
 
@@ -87,5 +57,35 @@ describe Rake::Funnel::Tasks::MSBuild do
87
57
  it 'should run with sh' do
88
58
  expect(subject).to have_received(:sh)
89
59
  end
60
+
61
+ describe 'overriding defaults' do
62
+ context 'when msbuild executable is specified' do
63
+ subject {
64
+ described_class.new do |t|
65
+ t.msbuild = 'custom build tool.exe'
66
+ end
67
+ }
68
+
69
+ its(:msbuild) { should == 'custom build tool.exe' }
70
+ end
71
+
72
+ context 'when project or solution is specified' do
73
+ before {
74
+ allow(Finder).to receive(:new).and_call_original
75
+ }
76
+
77
+ subject {
78
+ described_class.new do |t|
79
+ t.project_or_solution = 'project.sln'
80
+ end
81
+ }
82
+
83
+ its(:project_or_solution) { should be_instance_of(Finder) }
84
+
85
+ it 'should set project or solution' do
86
+ expect(Finder).to have_received(:new).with('project.sln', subject, 'No projects or more than one project found.')
87
+ end
88
+ end
89
+ end
90
90
  end
91
91
  end
@@ -5,7 +5,6 @@ include Rake::Funnel::Support::MSDeploy
5
5
 
6
6
  describe Rake::Funnel::Tasks::MSDeploy do
7
7
  before {
8
- CLEAN.clear
9
8
  Task.clear
10
9
  }
11
10
 
@@ -15,33 +14,11 @@ describe Rake::Funnel::Tasks::MSDeploy do
15
14
  its(:log_file) { should == 'msdeploy.log' }
16
15
  its(:args) { should == {} }
17
16
 
18
- it 'should add the log file to the files to be cleaned' do
19
- expect(CLEAN).to include(subject.log_file)
20
- end
21
- end
22
-
23
- describe 'overriding defaults' do
24
17
  context 'when task name is specified' do
25
18
  it 'should have a default log file equal to the task name' do
26
19
  expect(described_class.new(:foo).log_file).to eq('foo.log')
27
20
  end
28
21
  end
29
-
30
- context 'when task name and log file is specified' do
31
- subject! {
32
- described_class.new(:foo) do |t|
33
- t.log_file = 'bar.log'
34
- end
35
- }
36
-
37
- it 'should use custom log file' do
38
- expect(subject.log_file).to eq('bar.log')
39
- end
40
-
41
- it 'should add the log file to the files to be cleaned' do
42
- expect(CLEAN).to include(subject.log_file)
43
- end
44
- end
45
22
  end
46
23
 
47
24
  describe 'execution' do
@@ -15,18 +15,6 @@ describe Rake::Funnel::Tasks::NUnit do
15
15
  its(:files) { should == %w(build/specs/**/*.dll build/specs/**/*.exe) }
16
16
  end
17
17
 
18
- describe 'overriding defaults' do
19
- context 'when NUnit executable is specified' do
20
- subject {
21
- described_class.new do |t|
22
- t.nunit = 'custom nunit.exe'
23
- end
24
- }
25
-
26
- its(:nunit) { should == 'custom nunit.exe' }
27
- end
28
- end
29
-
30
18
  describe 'execution' do
31
19
  let(:args) { {} }
32
20
 
@@ -40,7 +28,7 @@ describe Rake::Funnel::Tasks::NUnit do
40
28
  allow(Finder).to receive(:new).and_return(finder)
41
29
  allow(NUnitPlugin).to receive(:setup)
42
30
 
43
- allow(Mono).to receive(:invocation).and_wrap_original do |original_method, *args, &block|
31
+ allow(Mono).to receive(:invocation).and_wrap_original do |_original_method, *args, &_block|
44
32
  args.compact
45
33
  end
46
34
  }
@@ -72,5 +60,15 @@ describe Rake::Funnel::Tasks::NUnit do
72
60
  it 'should run with sh' do
73
61
  expect(subject).to have_received(:sh)
74
62
  end
63
+
64
+ context 'with custom NUnit executable' do
65
+ subject {
66
+ described_class.new do |t|
67
+ t.nunit = 'custom nunit.exe'
68
+ end
69
+ }
70
+
71
+ its(:nunit) { should == 'custom nunit.exe' }
72
+ end
75
73
  end
76
74
  end
@@ -14,57 +14,15 @@ describe Rake::Funnel::Tasks::Paket do
14
14
  its(:bootstrapper_args) { should == nil }
15
15
  end
16
16
 
17
- describe 'overriding defaults' do
18
- context 'when bootstrapper executable is specified' do
19
- subject {
20
- described_class.new do |t|
21
- t.bootstrapper = 'custom bootstrapper.exe'
22
- end
23
- }
24
-
25
- its(:bootstrapper) { should == 'custom bootstrapper.exe' }
26
- end
27
-
28
- context 'when bootstrapper args are specified' do
29
- subject {
30
- described_class.new do |t|
31
- t.bootstrapper_args = %w(arg1 arg2)
32
- end
33
- }
34
-
35
- its(:bootstrapper_args) { should == %w(arg1 arg2) }
36
- end
37
-
38
- context 'when paket executable is specified' do
39
- subject {
40
- described_class.new do |t|
41
- t.paket = 'custom paket.exe'
42
- end
43
- }
44
-
45
- its(:paket) { should == 'custom paket.exe' }
46
- end
47
-
48
- context 'when paket args are specified' do
49
- subject {
50
- described_class.new do |t|
51
- t.paket_args = %w(arg1 arg2)
52
- end
53
- }
54
-
55
- its(:paket_args) { should == %w(arg1 arg2) }
56
- end
57
- end
58
-
59
17
  describe 'execution' do
60
18
  before {
61
19
  allow(subject).to receive(:sh)
62
- allow(Mono).to receive(:invocation).and_wrap_original do |original_method, *args, &block|
20
+ allow(Mono).to receive(:invocation).and_wrap_original do |_original_method, *args, &_block|
63
21
  args.compact
64
22
  end
65
23
  }
66
24
 
67
- context 'with overridden defaults' do
25
+ context 'overriding defaults' do
68
26
  subject {
69
27
  described_class.new do |t|
70
28
  t.bootstrapper = 'custom bootstrapper.exe'
@@ -75,7 +33,7 @@ describe Rake::Funnel::Tasks::Paket do
75
33
  }
76
34
 
77
35
  before {
78
- allow(File).to receive(:exist?).with(subject.paket).and_return(false)
36
+ allow(File).to receive(:exist?).and_return(false)
79
37
  allow(subject).to receive(:sh)
80
38
  }
81
39
 
@@ -5,7 +5,6 @@ include Rake::Funnel::Support
5
5
 
6
6
  describe Rake::Funnel::Tasks::QuickTemplate do
7
7
  before {
8
- CLEAN.clear
9
8
  Task.clear
10
9
  }
11
10
 
@@ -13,32 +12,6 @@ describe Rake::Funnel::Tasks::QuickTemplate do
13
12
  its(:name) { should == :template }
14
13
  its(:search_pattern) { should eq(%w(**/*.erb)) }
15
14
  its(:context) { should kind_of?(Binding) }
16
-
17
- describe 'target files are cleaned' do
18
- let(:templates) { [] }
19
- let(:finder) { double(Finder).as_null_object }
20
-
21
- before {
22
- allow(finder).to receive(:all_or_default).and_return(templates)
23
- allow(Finder).to receive(:new).and_return(finder)
24
- }
25
-
26
- subject! { described_class.new }
27
-
28
- context 'no templates found' do
29
- it 'should not add the target files' do
30
- expect(CLEAN).to be_empty
31
- end
32
- end
33
-
34
- context 'templates found' do
35
- let(:templates) { %w(1.template foo/2.template bar/3.some_other_extension) }
36
-
37
- it 'should add the target files' do
38
- expect(CLEAN).to match_array(%w(1 foo/2 bar/3))
39
- end
40
- end
41
- end
42
15
  end
43
16
 
44
17
  describe 'execution' do
@@ -2,7 +2,6 @@ require 'tmpdir'
2
2
 
3
3
  include Rake
4
4
  include Rake::Funnel::Support
5
- include Rake::Funnel::Support::SideBySideSpecs
6
5
 
7
6
  describe Rake::Funnel::Tasks::SideBySideSpecs do
8
7
  before {
@@ -28,7 +27,7 @@ describe Rake::Funnel::Tasks::SideBySideSpecs do
28
27
  }
29
28
 
30
29
  before {
31
- allow(Remover).to receive(:remove)
30
+ allow(SpecsRemover).to receive(:remove)
32
31
  }
33
32
 
34
33
  before {
@@ -39,7 +38,7 @@ describe Rake::Funnel::Tasks::SideBySideSpecs do
39
38
  let(:enabled) { true }
40
39
 
41
40
  it 'should use remover' do
42
- expect(Remover).to have_received(:remove)
41
+ expect(SpecsRemover).to have_received(:remove)
43
42
  .with({
44
43
  projects: subject.projects,
45
44
  references: subject.references,
@@ -52,7 +51,7 @@ describe Rake::Funnel::Tasks::SideBySideSpecs do
52
51
  let(:enabled) { false }
53
52
 
54
53
  it 'should do nothing' do
55
- expect(Remover).not_to have_received(:remove)
54
+ expect(SpecsRemover).not_to have_received(:remove)
56
55
  end
57
56
  end
58
57
  end