rake-funnel 0.3.2.pre → 0.4.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.
- checksums.yaml +4 -4
- data/.rspec +2 -2
- data/Gemfile +4 -0
- data/README.md +2 -2
- data/lib/rake/funnel/ambiguous_file_error.rb +31 -29
- data/lib/rake/funnel/execution_error.rb +28 -26
- data/lib/rake/funnel/extensions/case/camel_case.rb +24 -19
- data/lib/rake/funnel/extensions/case/pascal_case.rb +24 -19
- data/lib/rake/funnel/extensions/case.rb +3 -3
- data/lib/rake/funnel/extensions/common_path.rb +60 -52
- data/lib/rake/funnel/extensions/disable_colors.rb +33 -27
- data/lib/rake/funnel/extensions/rexml.rb +27 -23
- data/lib/rake/funnel/extensions/shell.rb +92 -56
- data/lib/rake/funnel/extensions/windows_path.rb +15 -11
- data/lib/rake/funnel/framework.rb +11 -16
- data/lib/rake/funnel/integration/progress_report.rb +72 -70
- data/lib/rake/funnel/integration/sync_output.rb +12 -8
- data/lib/rake/funnel/integration/teamcity/nunit_plugin.rb +61 -55
- data/lib/rake/funnel/integration/teamcity/progress_report.rb +39 -33
- data/lib/rake/funnel/integration/teamcity/service_messages.rb +46 -40
- data/lib/rake/funnel/integration/teamcity/teamcity.rb +19 -15
- data/lib/rake/funnel/integration/teamcity.rb +3 -5
- data/lib/rake/funnel/support/argument_mapper/key_value_pair.rb +16 -10
- data/lib/rake/funnel/support/argument_mapper/styles/default.rb +39 -31
- data/lib/rake/funnel/support/argument_mapper/styles/msbuild.rb +41 -33
- data/lib/rake/funnel/support/argument_mapper/styles/msdeploy.rb +55 -47
- data/lib/rake/funnel/support/argument_mapper/styles/nunit.rb +41 -33
- data/lib/rake/funnel/support/argument_mapper/styles.rb +3 -5
- data/lib/rake/funnel/support/argument_mapper/switch.rb +16 -10
- data/lib/rake/funnel/support/argument_mapper/value.rb +16 -10
- data/lib/rake/funnel/support/assembly_version/from_version_files.rb +39 -35
- data/lib/rake/funnel/support/assembly_version/languages/cs +5 -5
- data/lib/rake/funnel/support/assembly_version/languages/fs +12 -12
- data/lib/rake/funnel/support/assembly_version/languages/vb +5 -5
- data/lib/rake/funnel/support/assembly_version_writer.rb +56 -52
- data/lib/rake/funnel/support/binary_version_reader.rb +37 -32
- data/lib/rake/funnel/support/copier.rb +31 -27
- data/lib/rake/funnel/support/environments/loader.rb +46 -40
- data/lib/rake/funnel/support/environments.rb +3 -3
- data/lib/rake/funnel/support/internal/finder.rb +55 -51
- data/lib/rake/funnel/support/internal/instantiate_symbol.rb +38 -34
- data/lib/rake/funnel/support/mapper.rb +57 -53
- data/lib/rake/funnel/support/mono.rb +21 -17
- data/lib/rake/funnel/support/msbuild/build_tool.rb +30 -24
- data/lib/rake/funnel/support/msbuild.rb +3 -3
- data/lib/rake/funnel/support/msdeploy/registry_patch.rb +90 -84
- data/lib/rake/funnel/support/msdeploy.rb +3 -3
- data/lib/rake/funnel/support/patch.rb +41 -37
- data/lib/rake/funnel/support/specs_remover.rb +66 -62
- data/lib/rake/funnel/support/template_engine.rb +30 -26
- data/lib/rake/funnel/support/timing/report.rb +95 -89
- data/lib/rake/funnel/support/timing/statistics.rb +32 -26
- data/lib/rake/funnel/support/timing.rb +3 -3
- data/lib/rake/funnel/support/version_info.rb +103 -72
- data/lib/rake/funnel/support/which.rb +19 -15
- data/lib/rake/funnel/support/zipper.rb +53 -49
- data/lib/rake/funnel/tasks/assembly_version.rb +44 -40
- data/lib/rake/funnel/tasks/bin_path.rb +45 -41
- data/lib/rake/funnel/tasks/copy.rb +43 -39
- data/lib/rake/funnel/tasks/environments.rb +89 -89
- data/lib/rake/funnel/tasks/msbuild.rb +55 -51
- data/lib/rake/funnel/tasks/msdeploy.rb +54 -50
- data/lib/rake/funnel/tasks/nunit.rb +52 -48
- data/lib/rake/funnel/tasks/paket.rb +51 -47
- data/lib/rake/funnel/tasks/quick_template.rb +53 -49
- data/lib/rake/funnel/tasks/side_by_side_specs.rb +41 -37
- data/lib/rake/funnel/tasks/timing.rb +108 -104
- data/lib/rake/funnel/tasks/zip.rb +46 -42
- data/lib/rake/funnel/version.rb +1 -1
- data/lib/rake/funnel.rb +7 -7
- data/rake-funnel.gemspec +12 -3
- data/spec/rake/funnel/execution_error_spec.rb +67 -67
- data/spec/rake/funnel/extensions/case/camel_case_spec.rb +17 -17
- data/spec/rake/funnel/extensions/case/pascal_case_spec.rb +17 -17
- data/spec/rake/funnel/extensions/common_path_spec.rb +56 -56
- data/spec/rake/funnel/extensions/disable_colors_spec.rb +33 -33
- data/spec/rake/funnel/extensions/rexml_spec.rb +20 -20
- data/spec/rake/funnel/extensions/shell_spec.rb +237 -237
- data/spec/rake/funnel/extensions/windows_path_spec.rb +5 -5
- data/spec/rake/funnel/integration/progress_report_spec.rb +149 -149
- data/spec/rake/funnel/integration/sync_output_spec.rb +16 -16
- data/spec/rake/funnel/integration/teamcity/nunit_plugin_spec.rb +110 -110
- data/spec/rake/funnel/integration/teamcity/progress_report_spec.rb +174 -174
- data/spec/rake/funnel/integration/teamcity/service_messages_spec.rb +136 -136
- data/spec/rake/funnel/integration/teamcity/teamcity_spec.rb +34 -34
- data/spec/rake/funnel/support/argument_mapper/styles/msdeploy_spec.rb +222 -222
- data/spec/rake/funnel/support/argument_mapper/styles/nunit_spec.rb +25 -25
- data/spec/rake/funnel/support/argument_mapper/styles/styles_spec.rb +214 -214
- data/spec/rake/funnel/support/assembly_version/from_version_files_spec.rb +66 -61
- data/spec/rake/funnel/support/assembly_version_writer_spec.rb +140 -140
- data/spec/rake/funnel/support/binary_version_reader_spec.rb +29 -29
- data/spec/rake/funnel/support/copier_spec.rb +58 -58
- data/spec/rake/funnel/support/environments/loader_spec.rb +143 -143
- data/spec/rake/funnel/support/internal/finder_spec.rb +229 -229
- data/spec/rake/funnel/support/internal/instantiate_symbol_spec.rb +182 -183
- data/spec/rake/funnel/support/mapper_spec.rb +87 -87
- data/spec/rake/funnel/support/mono_spec.rb +57 -57
- data/spec/rake/funnel/support/msbuild/build_tool_spec.rb +21 -21
- data/spec/rake/funnel/support/msdeploy/registry_patch_spec.rb +139 -139
- data/spec/rake/funnel/support/patch_spec.rb +108 -108
- data/spec/rake/funnel/support/specs_remover/Sample.csproj +28 -28
- data/spec/rake/funnel/support/specs_remover_spec.rb +116 -116
- data/spec/rake/funnel/support/template_engine_spec.rb +65 -65
- data/spec/rake/funnel/support/timing/report_spec.rb +129 -129
- data/spec/rake/funnel/support/version_info_spec.rb +333 -228
- data/spec/rake/funnel/support/which_spec.rb +65 -65
- data/spec/rake/funnel/support/zipper_spec.rb +77 -77
- data/spec/rake/funnel/tasks/assembly_version_spec.rb +45 -45
- data/spec/rake/funnel/tasks/bin_path_spec.rb +52 -52
- data/spec/rake/funnel/tasks/copy_spec.rb +44 -44
- data/spec/rake/funnel/tasks/environments_spec.rb +249 -247
- data/spec/rake/funnel/tasks/msbuild_spec.rb +91 -91
- data/spec/rake/funnel/tasks/msdeploy_spec.rb +220 -220
- data/spec/rake/funnel/tasks/nunit_spec.rb +74 -74
- data/spec/rake/funnel/tasks/paket_spec.rb +140 -142
- data/spec/rake/funnel/tasks/quick_template_spec.rb +62 -62
- data/spec/rake/funnel/tasks/side_by_side_specs_spec.rb +58 -58
- data/spec/rake/funnel/tasks/timing_spec.rb +133 -133
- data/spec/rake/funnel/tasks/zip_spec.rb +50 -50
- data/spec/spec_helper.rb +43 -33
- metadata +2 -3
- data/lib/rake/funnel/support/side_by_side_specs.rb +0 -3
@@ -1,229 +1,229 @@
|
|
1
|
-
require 'tmpdir'
|
2
|
-
|
3
|
-
include Rake::Funnel
|
4
|
-
|
5
|
-
describe Rake::Funnel::Support::Finder do
|
6
|
-
let(:pattern) { %W(#{temp_dir}/**/*.sln #{temp_dir}/**/*.??proj) }
|
7
|
-
let(:generate) { [] }
|
8
|
-
let(:temp_dir) { Dir.mktmpdir }
|
9
|
-
|
10
|
-
before {
|
11
|
-
Dir.chdir(temp_dir) do
|
12
|
-
([] << generate).flatten.each do |file|
|
13
|
-
FileUtils.mkdir_p(File.dirname(file))
|
14
|
-
FileUtils.touch(file)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
}
|
18
|
-
|
19
|
-
after {
|
20
|
-
FileUtils.rm_rf(temp_dir)
|
21
|
-
}
|
22
|
-
|
23
|
-
subject {
|
24
|
-
described_class.new(pattern, OpenStruct.new(name: 'task name'), 'error message')
|
25
|
-
}
|
26
|
-
|
27
|
-
def map_temp(*files)
|
28
|
-
mapped = files.map { |f| File.join(temp_dir, f) }
|
29
|
-
return mapped.first if mapped.one?
|
30
|
-
mapped
|
31
|
-
end
|
32
|
-
|
33
|
-
describe 'enumerable' do
|
34
|
-
let(:generate) { %w(1 2 3 4) }
|
35
|
-
let(:pattern) { '**/*' }
|
36
|
-
|
37
|
-
it { is_expected.to be_kind_of(Enumerable) }
|
38
|
-
it { is_expected.to respond_to(:each) }
|
39
|
-
|
40
|
-
it 'should yield enumerator' do
|
41
|
-
expect(subject.each).to be_kind_of(Enumerator)
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'should support enumerable methods' do
|
45
|
-
Dir.chdir(temp_dir) do
|
46
|
-
items = subject.map { |x| x }
|
47
|
-
expect(subject.all_or_default).to match_array(items)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
describe 'patterns' do
|
53
|
-
let(:generate) { %w(1 2 3 4) }
|
54
|
-
|
55
|
-
context 'single pattern' do
|
56
|
-
let(:pattern) { '**/*' }
|
57
|
-
|
58
|
-
it 'should yield' do
|
59
|
-
Dir.chdir(temp_dir) do
|
60
|
-
expect(subject.all_or_default).to match_array(generate)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
context 'pattern list' do
|
66
|
-
let(:pattern) { %w(**/*) }
|
67
|
-
|
68
|
-
it 'should yield' do
|
69
|
-
Dir.chdir(temp_dir) do
|
70
|
-
expect(subject.all_or_default).to match_array(generate)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
context 'Rake::FileList' do
|
76
|
-
let(:pattern) { FileList['**/*'] }
|
77
|
-
|
78
|
-
it 'should yield' do
|
79
|
-
Dir.chdir(temp_dir) do
|
80
|
-
expect(subject.all_or_default).to match_array(generate)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
context 'patterns generating multiple matches per file' do
|
86
|
-
let(:pattern) { %w(**/* **/*) }
|
87
|
-
|
88
|
-
it 'should remove duplicates' do
|
89
|
-
Dir.chdir(temp_dir) do
|
90
|
-
expect(subject.all_or_default).to match_array(generate)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
describe 'source is evaluated lazily' do
|
97
|
-
let(:pattern) { FileList['*.example'] }
|
98
|
-
|
99
|
-
it 'should detect new files' do
|
100
|
-
expect(subject.all_or_default).to be_empty
|
101
|
-
|
102
|
-
Dir.mktmpdir do |tmp|
|
103
|
-
Dir.chdir(tmp) do
|
104
|
-
FileUtils.touch('new file.example')
|
105
|
-
|
106
|
-
expect(subject.all).to include('new file.example')
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
describe '#single' do
|
113
|
-
context 'no matching files' do
|
114
|
-
it 'should fail' do
|
115
|
-
Dir.chdir(temp_dir) do
|
116
|
-
expect { subject.single }.to raise_error(AmbiguousFileError, /error message/)
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
context 'more than one matching file' do
|
122
|
-
let(:generate) { %w(foo/project1.sln foo/project2.sln) }
|
123
|
-
|
124
|
-
it 'should fail' do
|
125
|
-
Dir.chdir(temp_dir) do
|
126
|
-
expect { subject.single }.to raise_error(AmbiguousFileError, /error message/)
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
context 'one matching file' do
|
132
|
-
let(:generate) { 'foo/project.sln' }
|
133
|
-
|
134
|
-
it 'should yield match' do
|
135
|
-
Dir.chdir(temp_dir) do
|
136
|
-
expect(subject.single).to eq(map_temp(generate))
|
137
|
-
end
|
138
|
-
end
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
describe '#single_or_default' do
|
143
|
-
context 'no matching files' do
|
144
|
-
it 'should yield nil' do
|
145
|
-
Dir.chdir(temp_dir) do
|
146
|
-
expect(subject.single_or_default).to be_nil
|
147
|
-
end
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
context 'more than one matching file' do
|
152
|
-
let(:generate) { %w(foo/project1.sln foo/project2.sln) }
|
153
|
-
|
154
|
-
it 'should yield first match' do
|
155
|
-
Dir.chdir(temp_dir) do
|
156
|
-
expect(subject.single_or_default).to be_nil
|
157
|
-
end
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
context 'one matching file' do
|
162
|
-
let(:generate) { 'foo/project.sln' }
|
163
|
-
|
164
|
-
it 'should yield match' do
|
165
|
-
Dir.chdir(temp_dir) do
|
166
|
-
expect(subject.single_or_default).to eq(map_temp(generate))
|
167
|
-
end
|
168
|
-
end
|
169
|
-
end
|
170
|
-
end
|
171
|
-
|
172
|
-
describe '#all' do
|
173
|
-
context 'no matching files' do
|
174
|
-
it 'should fail' do
|
175
|
-
expect { subject.all }.to raise_error(AmbiguousFileError, /error message/)
|
176
|
-
end
|
177
|
-
end
|
178
|
-
|
179
|
-
context 'more than one matching file' do
|
180
|
-
let(:generate) { %w(foo/project1.sln foo/project2.sln) }
|
181
|
-
|
182
|
-
it 'should yield all matches' do
|
183
|
-
Dir.chdir(temp_dir) do
|
184
|
-
expect(subject.all).to match_array(map_temp(*generate))
|
185
|
-
end
|
186
|
-
end
|
187
|
-
end
|
188
|
-
|
189
|
-
context 'one matching file' do
|
190
|
-
let(:generate) { 'foo/project.sln' }
|
191
|
-
|
192
|
-
it 'should yield all matches' do
|
193
|
-
Dir.chdir(temp_dir) do
|
194
|
-
expect(subject.all).to match_array(map_temp(generate))
|
195
|
-
end
|
196
|
-
end
|
197
|
-
end
|
198
|
-
end
|
199
|
-
|
200
|
-
describe '#all_or_default' do
|
201
|
-
context 'no matching files' do
|
202
|
-
it 'should be empty' do
|
203
|
-
Dir.chdir(temp_dir) do
|
204
|
-
expect(subject.all_or_default).to be_empty
|
205
|
-
end
|
206
|
-
end
|
207
|
-
end
|
208
|
-
|
209
|
-
context 'more than one matching file' do
|
210
|
-
let(:generate) { %w(foo/project1.sln foo/project2.sln) }
|
211
|
-
|
212
|
-
it 'should yield all matches' do
|
213
|
-
Dir.chdir(temp_dir) do
|
214
|
-
expect(subject.all_or_default).to match_array(map_temp(*generate))
|
215
|
-
end
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
|
-
context 'one matching file' do
|
220
|
-
let(:generate) { 'foo/project.sln' }
|
221
|
-
|
222
|
-
it 'should yield all matches' do
|
223
|
-
Dir.chdir(temp_dir) do
|
224
|
-
expect(subject.all_or_default).to match_array(map_temp(generate))
|
225
|
-
end
|
226
|
-
end
|
227
|
-
end
|
228
|
-
end
|
229
|
-
end
|
1
|
+
require 'tmpdir'
|
2
|
+
|
3
|
+
include Rake::Funnel
|
4
|
+
|
5
|
+
describe Rake::Funnel::Support::Finder do
|
6
|
+
let(:pattern) { %W(#{temp_dir}/**/*.sln #{temp_dir}/**/*.??proj) }
|
7
|
+
let(:generate) { [] }
|
8
|
+
let(:temp_dir) { Dir.mktmpdir }
|
9
|
+
|
10
|
+
before {
|
11
|
+
Dir.chdir(temp_dir) do
|
12
|
+
([] << generate).flatten.each do |file|
|
13
|
+
FileUtils.mkdir_p(File.dirname(file))
|
14
|
+
FileUtils.touch(file)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
}
|
18
|
+
|
19
|
+
after {
|
20
|
+
FileUtils.rm_rf(temp_dir)
|
21
|
+
}
|
22
|
+
|
23
|
+
subject {
|
24
|
+
described_class.new(pattern, OpenStruct.new(name: 'task name'), 'error message')
|
25
|
+
}
|
26
|
+
|
27
|
+
def map_temp(*files)
|
28
|
+
mapped = files.map { |f| File.join(temp_dir, f) }
|
29
|
+
return mapped.first if mapped.one?
|
30
|
+
mapped
|
31
|
+
end
|
32
|
+
|
33
|
+
describe 'enumerable' do
|
34
|
+
let(:generate) { %w(1 2 3 4) }
|
35
|
+
let(:pattern) { '**/*' }
|
36
|
+
|
37
|
+
it { is_expected.to be_kind_of(Enumerable) }
|
38
|
+
it { is_expected.to respond_to(:each) }
|
39
|
+
|
40
|
+
it 'should yield enumerator' do
|
41
|
+
expect(subject.each).to be_kind_of(Enumerator)
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should support enumerable methods' do
|
45
|
+
Dir.chdir(temp_dir) do
|
46
|
+
items = subject.map { |x| x }
|
47
|
+
expect(subject.all_or_default).to match_array(items)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe 'patterns' do
|
53
|
+
let(:generate) { %w(1 2 3 4) }
|
54
|
+
|
55
|
+
context 'single pattern' do
|
56
|
+
let(:pattern) { '**/*' }
|
57
|
+
|
58
|
+
it 'should yield' do
|
59
|
+
Dir.chdir(temp_dir) do
|
60
|
+
expect(subject.all_or_default).to match_array(generate)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
context 'pattern list' do
|
66
|
+
let(:pattern) { %w(**/*) }
|
67
|
+
|
68
|
+
it 'should yield' do
|
69
|
+
Dir.chdir(temp_dir) do
|
70
|
+
expect(subject.all_or_default).to match_array(generate)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
context 'Rake::FileList' do
|
76
|
+
let(:pattern) { FileList['**/*'] }
|
77
|
+
|
78
|
+
it 'should yield' do
|
79
|
+
Dir.chdir(temp_dir) do
|
80
|
+
expect(subject.all_or_default).to match_array(generate)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
context 'patterns generating multiple matches per file' do
|
86
|
+
let(:pattern) { %w(**/* **/*) }
|
87
|
+
|
88
|
+
it 'should remove duplicates' do
|
89
|
+
Dir.chdir(temp_dir) do
|
90
|
+
expect(subject.all_or_default).to match_array(generate)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
describe 'source is evaluated lazily' do
|
97
|
+
let(:pattern) { FileList['*.example'] }
|
98
|
+
|
99
|
+
it 'should detect new files' do
|
100
|
+
expect(subject.all_or_default).to be_empty
|
101
|
+
|
102
|
+
Dir.mktmpdir do |tmp|
|
103
|
+
Dir.chdir(tmp) do
|
104
|
+
FileUtils.touch('new file.example')
|
105
|
+
|
106
|
+
expect(subject.all).to include('new file.example')
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
describe '#single' do
|
113
|
+
context 'no matching files' do
|
114
|
+
it 'should fail' do
|
115
|
+
Dir.chdir(temp_dir) do
|
116
|
+
expect { subject.single }.to raise_error(AmbiguousFileError, /error message/)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
context 'more than one matching file' do
|
122
|
+
let(:generate) { %w(foo/project1.sln foo/project2.sln) }
|
123
|
+
|
124
|
+
it 'should fail' do
|
125
|
+
Dir.chdir(temp_dir) do
|
126
|
+
expect { subject.single }.to raise_error(AmbiguousFileError, /error message/)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
context 'one matching file' do
|
132
|
+
let(:generate) { 'foo/project.sln' }
|
133
|
+
|
134
|
+
it 'should yield match' do
|
135
|
+
Dir.chdir(temp_dir) do
|
136
|
+
expect(subject.single).to eq(map_temp(generate))
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
describe '#single_or_default' do
|
143
|
+
context 'no matching files' do
|
144
|
+
it 'should yield nil' do
|
145
|
+
Dir.chdir(temp_dir) do
|
146
|
+
expect(subject.single_or_default).to be_nil
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
context 'more than one matching file' do
|
152
|
+
let(:generate) { %w(foo/project1.sln foo/project2.sln) }
|
153
|
+
|
154
|
+
it 'should yield first match' do
|
155
|
+
Dir.chdir(temp_dir) do
|
156
|
+
expect(subject.single_or_default).to be_nil
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
context 'one matching file' do
|
162
|
+
let(:generate) { 'foo/project.sln' }
|
163
|
+
|
164
|
+
it 'should yield match' do
|
165
|
+
Dir.chdir(temp_dir) do
|
166
|
+
expect(subject.single_or_default).to eq(map_temp(generate))
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
describe '#all' do
|
173
|
+
context 'no matching files' do
|
174
|
+
it 'should fail' do
|
175
|
+
expect { subject.all }.to raise_error(AmbiguousFileError, /error message/)
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
context 'more than one matching file' do
|
180
|
+
let(:generate) { %w(foo/project1.sln foo/project2.sln) }
|
181
|
+
|
182
|
+
it 'should yield all matches' do
|
183
|
+
Dir.chdir(temp_dir) do
|
184
|
+
expect(subject.all).to match_array(map_temp(*generate))
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
context 'one matching file' do
|
190
|
+
let(:generate) { 'foo/project.sln' }
|
191
|
+
|
192
|
+
it 'should yield all matches' do
|
193
|
+
Dir.chdir(temp_dir) do
|
194
|
+
expect(subject.all).to match_array(map_temp(generate))
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
describe '#all_or_default' do
|
201
|
+
context 'no matching files' do
|
202
|
+
it 'should be empty' do
|
203
|
+
Dir.chdir(temp_dir) do
|
204
|
+
expect(subject.all_or_default).to be_empty
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
context 'more than one matching file' do
|
210
|
+
let(:generate) { %w(foo/project1.sln foo/project2.sln) }
|
211
|
+
|
212
|
+
it 'should yield all matches' do
|
213
|
+
Dir.chdir(temp_dir) do
|
214
|
+
expect(subject.all_or_default).to match_array(map_temp(*generate))
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
context 'one matching file' do
|
220
|
+
let(:generate) { 'foo/project.sln' }
|
221
|
+
|
222
|
+
it 'should yield all matches' do
|
223
|
+
Dir.chdir(temp_dir) do
|
224
|
+
expect(subject.all_or_default).to match_array(map_temp(generate))
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|
229
|
+
end
|