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,34 +1,34 @@
|
|
1
|
-
describe Rake::Funnel::Integration::TeamCity do
|
2
|
-
before {
|
3
|
-
allow(ENV).to receive(:include?).with(described_class::ENV_VAR).and_return(teamcity_running?)
|
4
|
-
}
|
5
|
-
|
6
|
-
context 'when running outside TeamCity' do
|
7
|
-
let(:teamcity_running?) { false }
|
8
|
-
|
9
|
-
it 'should not detect TeamCity' do
|
10
|
-
expect(described_class.running?).to eq(false)
|
11
|
-
end
|
12
|
-
|
13
|
-
it "should not detect TeamCity's rake runner" do
|
14
|
-
expect(described_class.rake_runner?).to eq(false)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
context 'when running inside TeamCity' do
|
19
|
-
let(:teamcity_running?) { true }
|
20
|
-
|
21
|
-
it 'should detect TeamCity' do
|
22
|
-
expect(described_class.running?).to eq(true)
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should detect TeamCity's rake runner" do
|
26
|
-
module ::Rake
|
27
|
-
module TeamCityApplication
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
expect(described_class.rake_runner?).to eq(true)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
1
|
+
describe Rake::Funnel::Integration::TeamCity do
|
2
|
+
before {
|
3
|
+
allow(ENV).to receive(:include?).with(described_class::ENV_VAR).and_return(teamcity_running?)
|
4
|
+
}
|
5
|
+
|
6
|
+
context 'when running outside TeamCity' do
|
7
|
+
let(:teamcity_running?) { false }
|
8
|
+
|
9
|
+
it 'should not detect TeamCity' do
|
10
|
+
expect(described_class.running?).to eq(false)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should not detect TeamCity's rake runner" do
|
14
|
+
expect(described_class.rake_runner?).to eq(false)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'when running inside TeamCity' do
|
19
|
+
let(:teamcity_running?) { true }
|
20
|
+
|
21
|
+
it 'should detect TeamCity' do
|
22
|
+
expect(described_class.running?).to eq(true)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should detect TeamCity's rake runner" do
|
26
|
+
module ::Rake
|
27
|
+
module TeamCityApplication
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
expect(described_class.rake_runner?).to eq(true)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -1,222 +1,222 @@
|
|
1
|
-
include Rake::Funnel::Support
|
2
|
-
|
3
|
-
describe Rake::Funnel::Support::Mapper::Styles::MSDeploy do
|
4
|
-
subject { Mapper.new(:MSDeploy) }
|
5
|
-
|
6
|
-
describe 'no arguments' do
|
7
|
-
it 'should convert no args to []' do
|
8
|
-
expect(subject.map).to match_array([])
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'should convert {} to []' do
|
12
|
-
expect(subject.map({})).to match_array([])
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
describe 'truthy arguments' do
|
17
|
-
it 'should convert switch => <true>' do
|
18
|
-
args = { switch: true }
|
19
|
-
expect(subject.map(args)).to match_array(['-switch:true'])
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'should convert switch => <truthy>' do
|
23
|
-
args = { switch: 1 }
|
24
|
-
expect(subject.map(args)).to match_array(['-switch:1'])
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'should convert switch => <symbol>' do
|
28
|
-
args = { switch: :one }
|
29
|
-
expect(subject.map(args)).to match_array(['-switch:one'])
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'should convert switch => <string>' do
|
33
|
-
args = { switch: 'one' }
|
34
|
-
expect(subject.map(args)).to match_array(['-switch:one'])
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'should convert switch => <truthy> enumerable' do
|
38
|
-
args = { switch: [true, 1] }
|
39
|
-
expect(subject.map(args)).to match_array(%w(-switch:true -switch:1))
|
40
|
-
end
|
41
|
-
|
42
|
-
it 'should convert hash values' do
|
43
|
-
args = { switch: { foo: true, bar: true } }
|
44
|
-
expect(subject.map(args)).to match_array(['-switch:foo=true,bar=true'])
|
45
|
-
end
|
46
|
-
|
47
|
-
it 'should convert enumerable hash values' do
|
48
|
-
args = { switch: [{ foo: true, bar: 1 }, { baz: :baz, foobar: 'foobar' }] }
|
49
|
-
expect(subject.map(args)).to match_array(%w(-switch:foo=true,bar=1 -switch:baz=baz,foobar=foobar))
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
describe 'falsy arguments' do
|
54
|
-
it 'should convert switch => <false>' do
|
55
|
-
args = { switch: false }
|
56
|
-
expect(subject.map(args)).to match_array(['-switch:false'])
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'should convert switch => <falsy>' do
|
60
|
-
args = { switch: nil }
|
61
|
-
expect(subject.map(args)).to match_array(['-switch'])
|
62
|
-
end
|
63
|
-
|
64
|
-
it 'should convert switch => <falsy> enumerable' do
|
65
|
-
args = { switch: [false, nil] }
|
66
|
-
expect(subject.map(args)).to match_array(%w(-switch:false -switch))
|
67
|
-
end
|
68
|
-
|
69
|
-
it 'should convert hash values' do
|
70
|
-
args = { switch: { foo: false, bar: nil } }
|
71
|
-
expect(subject.map(args)).to match_array(['-switch:foo=false,bar'])
|
72
|
-
end
|
73
|
-
|
74
|
-
it 'should convert enumerable hash values' do
|
75
|
-
args = { switch: [{ foo: false }, { bar: nil }] }
|
76
|
-
expect(subject.map(args)).to match_array(%w(-switch:foo=false -switch:bar))
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
describe 'complex types' do
|
81
|
-
it 'should convert switch => <enumerable>' do
|
82
|
-
args = { switch: [1, 'two'] }
|
83
|
-
expect(subject.map(args)).to match_array(%w(-switch:1 -switch:two))
|
84
|
-
end
|
85
|
-
|
86
|
-
it 'should convert switch => <hash>' do
|
87
|
-
args = { switch: { one: 1, two: 2 } }
|
88
|
-
expect(subject.map(args)).to match_array(['-switch:one=1,two=2'])
|
89
|
-
end
|
90
|
-
|
91
|
-
it 'should convert switch => <enumerable of hash>' do
|
92
|
-
args = { switch: [{ one: 1 }, { two: 2 }] }
|
93
|
-
expect(subject.map(args)).to match_array(%w(-switch:one=1 -switch:two=2))
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
describe 'snake case to camel case conversion' do
|
98
|
-
it 'should convert symbols keys' do
|
99
|
-
args = { some_switch: 1 }
|
100
|
-
expect(subject.map(args)).to match_array(['-someSwitch:1'])
|
101
|
-
end
|
102
|
-
|
103
|
-
it 'should convert symbol values' do
|
104
|
-
args = { switch: :some_value }
|
105
|
-
expect(subject.map(args)).to match_array(['-switch:someValue'])
|
106
|
-
end
|
107
|
-
|
108
|
-
it 'should convert enumerable values' do
|
109
|
-
args = { switch: [:some_value] }
|
110
|
-
expect(subject.map(args)).to match_array(['-switch:someValue'])
|
111
|
-
end
|
112
|
-
|
113
|
-
it 'should convert hash values' do
|
114
|
-
args = { switch: { key: :some_value } }
|
115
|
-
expect(subject.map(args)).to match_array(['-switch:key=someValue'])
|
116
|
-
end
|
117
|
-
|
118
|
-
it 'should convert hash keys' do
|
119
|
-
args = { switch: { some_key: true } }
|
120
|
-
expect(subject.map(args)).to match_array(['-switch:someKey=true'])
|
121
|
-
end
|
122
|
-
|
123
|
-
it 'should convert enumerable hash values' do
|
124
|
-
args = { switch: [{ key: :some_value }] }
|
125
|
-
expect(subject.map(args)).to match_array(['-switch:key=someValue'])
|
126
|
-
end
|
127
|
-
|
128
|
-
it 'should convert enumerable hash keys' do
|
129
|
-
args = { switch: [{ some_key: true }] }
|
130
|
-
expect(subject.map(args)).to match_array(['-switch:someKey=true'])
|
131
|
-
end
|
132
|
-
|
133
|
-
it 'should not convert strings' do
|
134
|
-
args = { 'some_switch' => 'some_value' }
|
135
|
-
expect(subject.map(args)).to match_array(['-some_switch:some_value'])
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
describe 'whitespace' do
|
140
|
-
describe 'keys' do
|
141
|
-
context 'without quotes' do
|
142
|
-
it 'should enclose keys in "' do
|
143
|
-
args = { 'some key' => 1 }
|
144
|
-
expect(subject.map(args)).to match_array(['-"some key":1'])
|
145
|
-
end
|
146
|
-
|
147
|
-
it 'should enclose hash keys in "' do
|
148
|
-
args = { switch: { 'some key' => 1 } }
|
149
|
-
expect(subject.map(args)).to match_array(['-switch:"some key"=1'])
|
150
|
-
end
|
151
|
-
|
152
|
-
it 'should enclose enumerable hash keys in "' do
|
153
|
-
args = { switch: [{ 'some key' => 1 }] }
|
154
|
-
expect(subject.map(args)).to match_array(['-switch:"some key"=1'])
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
|
-
context 'with quotes' do
|
159
|
-
it 'should escape quotes' do
|
160
|
-
args = { 'some "key"' => 1 }
|
161
|
-
expect(subject.map(args)).to match_array(['-"some ""key""":1'])
|
162
|
-
end
|
163
|
-
|
164
|
-
it 'should escape quotes in hash keys' do
|
165
|
-
args = { switch: { 'some "key"' => 1 } }
|
166
|
-
expect(subject.map(args)).to match_array(['-switch:"some ""key"""=1'])
|
167
|
-
end
|
168
|
-
|
169
|
-
it 'should escape quotes in enumerable hash keys' do
|
170
|
-
args = { switch: [{ 'some "key"' => 1 }] }
|
171
|
-
expect(subject.map(args)).to match_array(['-switch:"some ""key"""=1'])
|
172
|
-
end
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
describe 'values' do
|
177
|
-
context 'without quotes' do
|
178
|
-
it 'should enclose values in "' do
|
179
|
-
args = { switch: 'some value' }
|
180
|
-
expect(subject.map(args)).to match_array(['-switch:"some value"'])
|
181
|
-
end
|
182
|
-
|
183
|
-
it 'should enclose enumerable values in "' do
|
184
|
-
args = { switch: ['some value'] }
|
185
|
-
expect(subject.map(args)).to match_array(['-switch:"some value"'])
|
186
|
-
end
|
187
|
-
|
188
|
-
it 'should enclose hash values in "' do
|
189
|
-
args = { switch: { key: 'some value' } }
|
190
|
-
expect(subject.map(args)).to match_array(['-switch:key="some value"'])
|
191
|
-
end
|
192
|
-
|
193
|
-
it 'should enclose enumerable hash values in "' do
|
194
|
-
args = { switch: [{ key: 'some value' }] }
|
195
|
-
expect(subject.map(args)).to match_array(['-switch:key="some value"'])
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
context 'with quotes' do
|
200
|
-
it 'should escape quotes' do
|
201
|
-
args = { switch: 'some "value"' }
|
202
|
-
expect(subject.map(args)).to match_array(['-switch:"some ""value"""'])
|
203
|
-
end
|
204
|
-
|
205
|
-
it 'should escape quotes in enumerable values' do
|
206
|
-
args = { switch: ['some "value"'] }
|
207
|
-
expect(subject.map(args)).to match_array(['-switch:"some ""value"""'])
|
208
|
-
end
|
209
|
-
|
210
|
-
it 'should escape quotes in hash values' do
|
211
|
-
args = { switch: { key: 'some "value"' } }
|
212
|
-
expect(subject.map(args)).to match_array(['-switch:key="some ""value"""'])
|
213
|
-
end
|
214
|
-
|
215
|
-
it 'should escape quotes in enumerable hash values' do
|
216
|
-
args = { switch: [{ key: 'some "value"' }] }
|
217
|
-
expect(subject.map(args)).to match_array(['-switch:key="some ""value"""'])
|
218
|
-
end
|
219
|
-
end
|
220
|
-
end
|
221
|
-
end
|
222
|
-
end
|
1
|
+
include Rake::Funnel::Support
|
2
|
+
|
3
|
+
describe Rake::Funnel::Support::Mapper::Styles::MSDeploy do
|
4
|
+
subject { Mapper.new(:MSDeploy) }
|
5
|
+
|
6
|
+
describe 'no arguments' do
|
7
|
+
it 'should convert no args to []' do
|
8
|
+
expect(subject.map).to match_array([])
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should convert {} to []' do
|
12
|
+
expect(subject.map({})).to match_array([])
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe 'truthy arguments' do
|
17
|
+
it 'should convert switch => <true>' do
|
18
|
+
args = { switch: true }
|
19
|
+
expect(subject.map(args)).to match_array(['-switch:true'])
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should convert switch => <truthy>' do
|
23
|
+
args = { switch: 1 }
|
24
|
+
expect(subject.map(args)).to match_array(['-switch:1'])
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'should convert switch => <symbol>' do
|
28
|
+
args = { switch: :one }
|
29
|
+
expect(subject.map(args)).to match_array(['-switch:one'])
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should convert switch => <string>' do
|
33
|
+
args = { switch: 'one' }
|
34
|
+
expect(subject.map(args)).to match_array(['-switch:one'])
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should convert switch => <truthy> enumerable' do
|
38
|
+
args = { switch: [true, 1] }
|
39
|
+
expect(subject.map(args)).to match_array(%w(-switch:true -switch:1))
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should convert hash values' do
|
43
|
+
args = { switch: { foo: true, bar: true } }
|
44
|
+
expect(subject.map(args)).to match_array(['-switch:foo=true,bar=true'])
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'should convert enumerable hash values' do
|
48
|
+
args = { switch: [{ foo: true, bar: 1 }, { baz: :baz, foobar: 'foobar' }] }
|
49
|
+
expect(subject.map(args)).to match_array(%w(-switch:foo=true,bar=1 -switch:baz=baz,foobar=foobar))
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe 'falsy arguments' do
|
54
|
+
it 'should convert switch => <false>' do
|
55
|
+
args = { switch: false }
|
56
|
+
expect(subject.map(args)).to match_array(['-switch:false'])
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'should convert switch => <falsy>' do
|
60
|
+
args = { switch: nil }
|
61
|
+
expect(subject.map(args)).to match_array(['-switch'])
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'should convert switch => <falsy> enumerable' do
|
65
|
+
args = { switch: [false, nil] }
|
66
|
+
expect(subject.map(args)).to match_array(%w(-switch:false -switch))
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'should convert hash values' do
|
70
|
+
args = { switch: { foo: false, bar: nil } }
|
71
|
+
expect(subject.map(args)).to match_array(['-switch:foo=false,bar'])
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'should convert enumerable hash values' do
|
75
|
+
args = { switch: [{ foo: false }, { bar: nil }] }
|
76
|
+
expect(subject.map(args)).to match_array(%w(-switch:foo=false -switch:bar))
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
describe 'complex types' do
|
81
|
+
it 'should convert switch => <enumerable>' do
|
82
|
+
args = { switch: [1, 'two'] }
|
83
|
+
expect(subject.map(args)).to match_array(%w(-switch:1 -switch:two))
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'should convert switch => <hash>' do
|
87
|
+
args = { switch: { one: 1, two: 2 } }
|
88
|
+
expect(subject.map(args)).to match_array(['-switch:one=1,two=2'])
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'should convert switch => <enumerable of hash>' do
|
92
|
+
args = { switch: [{ one: 1 }, { two: 2 }] }
|
93
|
+
expect(subject.map(args)).to match_array(%w(-switch:one=1 -switch:two=2))
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
describe 'snake case to camel case conversion' do
|
98
|
+
it 'should convert symbols keys' do
|
99
|
+
args = { some_switch: 1 }
|
100
|
+
expect(subject.map(args)).to match_array(['-someSwitch:1'])
|
101
|
+
end
|
102
|
+
|
103
|
+
it 'should convert symbol values' do
|
104
|
+
args = { switch: :some_value }
|
105
|
+
expect(subject.map(args)).to match_array(['-switch:someValue'])
|
106
|
+
end
|
107
|
+
|
108
|
+
it 'should convert enumerable values' do
|
109
|
+
args = { switch: [:some_value] }
|
110
|
+
expect(subject.map(args)).to match_array(['-switch:someValue'])
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'should convert hash values' do
|
114
|
+
args = { switch: { key: :some_value } }
|
115
|
+
expect(subject.map(args)).to match_array(['-switch:key=someValue'])
|
116
|
+
end
|
117
|
+
|
118
|
+
it 'should convert hash keys' do
|
119
|
+
args = { switch: { some_key: true } }
|
120
|
+
expect(subject.map(args)).to match_array(['-switch:someKey=true'])
|
121
|
+
end
|
122
|
+
|
123
|
+
it 'should convert enumerable hash values' do
|
124
|
+
args = { switch: [{ key: :some_value }] }
|
125
|
+
expect(subject.map(args)).to match_array(['-switch:key=someValue'])
|
126
|
+
end
|
127
|
+
|
128
|
+
it 'should convert enumerable hash keys' do
|
129
|
+
args = { switch: [{ some_key: true }] }
|
130
|
+
expect(subject.map(args)).to match_array(['-switch:someKey=true'])
|
131
|
+
end
|
132
|
+
|
133
|
+
it 'should not convert strings' do
|
134
|
+
args = { 'some_switch' => 'some_value' }
|
135
|
+
expect(subject.map(args)).to match_array(['-some_switch:some_value'])
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
describe 'whitespace' do
|
140
|
+
describe 'keys' do
|
141
|
+
context 'without quotes' do
|
142
|
+
it 'should enclose keys in "' do
|
143
|
+
args = { 'some key' => 1 }
|
144
|
+
expect(subject.map(args)).to match_array(['-"some key":1'])
|
145
|
+
end
|
146
|
+
|
147
|
+
it 'should enclose hash keys in "' do
|
148
|
+
args = { switch: { 'some key' => 1 } }
|
149
|
+
expect(subject.map(args)).to match_array(['-switch:"some key"=1'])
|
150
|
+
end
|
151
|
+
|
152
|
+
it 'should enclose enumerable hash keys in "' do
|
153
|
+
args = { switch: [{ 'some key' => 1 }] }
|
154
|
+
expect(subject.map(args)).to match_array(['-switch:"some key"=1'])
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
context 'with quotes' do
|
159
|
+
it 'should escape quotes' do
|
160
|
+
args = { 'some "key"' => 1 }
|
161
|
+
expect(subject.map(args)).to match_array(['-"some ""key""":1'])
|
162
|
+
end
|
163
|
+
|
164
|
+
it 'should escape quotes in hash keys' do
|
165
|
+
args = { switch: { 'some "key"' => 1 } }
|
166
|
+
expect(subject.map(args)).to match_array(['-switch:"some ""key"""=1'])
|
167
|
+
end
|
168
|
+
|
169
|
+
it 'should escape quotes in enumerable hash keys' do
|
170
|
+
args = { switch: [{ 'some "key"' => 1 }] }
|
171
|
+
expect(subject.map(args)).to match_array(['-switch:"some ""key"""=1'])
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
describe 'values' do
|
177
|
+
context 'without quotes' do
|
178
|
+
it 'should enclose values in "' do
|
179
|
+
args = { switch: 'some value' }
|
180
|
+
expect(subject.map(args)).to match_array(['-switch:"some value"'])
|
181
|
+
end
|
182
|
+
|
183
|
+
it 'should enclose enumerable values in "' do
|
184
|
+
args = { switch: ['some value'] }
|
185
|
+
expect(subject.map(args)).to match_array(['-switch:"some value"'])
|
186
|
+
end
|
187
|
+
|
188
|
+
it 'should enclose hash values in "' do
|
189
|
+
args = { switch: { key: 'some value' } }
|
190
|
+
expect(subject.map(args)).to match_array(['-switch:key="some value"'])
|
191
|
+
end
|
192
|
+
|
193
|
+
it 'should enclose enumerable hash values in "' do
|
194
|
+
args = { switch: [{ key: 'some value' }] }
|
195
|
+
expect(subject.map(args)).to match_array(['-switch:key="some value"'])
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
context 'with quotes' do
|
200
|
+
it 'should escape quotes' do
|
201
|
+
args = { switch: 'some "value"' }
|
202
|
+
expect(subject.map(args)).to match_array(['-switch:"some ""value"""'])
|
203
|
+
end
|
204
|
+
|
205
|
+
it 'should escape quotes in enumerable values' do
|
206
|
+
args = { switch: ['some "value"'] }
|
207
|
+
expect(subject.map(args)).to match_array(['-switch:"some ""value"""'])
|
208
|
+
end
|
209
|
+
|
210
|
+
it 'should escape quotes in hash values' do
|
211
|
+
args = { switch: { key: 'some "value"' } }
|
212
|
+
expect(subject.map(args)).to match_array(['-switch:key="some ""value"""'])
|
213
|
+
end
|
214
|
+
|
215
|
+
it 'should escape quotes in enumerable hash values' do
|
216
|
+
args = { switch: [{ key: 'some "value"' }] }
|
217
|
+
expect(subject.map(args)).to match_array(['-switch:key="some ""value"""'])
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|
222
|
+
end
|
@@ -1,25 +1,25 @@
|
|
1
|
-
describe Rake::Funnel::Support::Mapper::Styles::NUnit do
|
2
|
-
subject { Mapper.new(:NUnit) }
|
3
|
-
|
4
|
-
describe 'prefix' do
|
5
|
-
before {
|
6
|
-
allow(Rake::Win32).to receive(:windows?).and_return(windows?)
|
7
|
-
}
|
8
|
-
|
9
|
-
context 'on Windows' do
|
10
|
-
let(:windows?) { true }
|
11
|
-
|
12
|
-
it "should use '/'" do
|
13
|
-
expect(subject.map({ switch: nil })).to eq(['/switch'])
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
context 'not on Windows' do
|
18
|
-
let(:windows?) { false }
|
19
|
-
|
20
|
-
it "should use '-'" do
|
21
|
-
expect(subject.map({ switch: nil })).to eq(['-switch'])
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
1
|
+
describe Rake::Funnel::Support::Mapper::Styles::NUnit do
|
2
|
+
subject { Mapper.new(:NUnit) }
|
3
|
+
|
4
|
+
describe 'prefix' do
|
5
|
+
before {
|
6
|
+
allow(Rake::Win32).to receive(:windows?).and_return(windows?)
|
7
|
+
}
|
8
|
+
|
9
|
+
context 'on Windows' do
|
10
|
+
let(:windows?) { true }
|
11
|
+
|
12
|
+
it "should use '/'" do
|
13
|
+
expect(subject.map({ switch: nil })).to eq(['/switch'])
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context 'not on Windows' do
|
18
|
+
let(:windows?) { false }
|
19
|
+
|
20
|
+
it "should use '-'" do
|
21
|
+
expect(subject.map({ switch: nil })).to eq(['-switch'])
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|