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.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +2 -2
  3. data/Gemfile +4 -0
  4. data/README.md +2 -2
  5. data/lib/rake/funnel/ambiguous_file_error.rb +31 -29
  6. data/lib/rake/funnel/execution_error.rb +28 -26
  7. data/lib/rake/funnel/extensions/case/camel_case.rb +24 -19
  8. data/lib/rake/funnel/extensions/case/pascal_case.rb +24 -19
  9. data/lib/rake/funnel/extensions/case.rb +3 -3
  10. data/lib/rake/funnel/extensions/common_path.rb +60 -52
  11. data/lib/rake/funnel/extensions/disable_colors.rb +33 -27
  12. data/lib/rake/funnel/extensions/rexml.rb +27 -23
  13. data/lib/rake/funnel/extensions/shell.rb +92 -56
  14. data/lib/rake/funnel/extensions/windows_path.rb +15 -11
  15. data/lib/rake/funnel/framework.rb +11 -16
  16. data/lib/rake/funnel/integration/progress_report.rb +72 -70
  17. data/lib/rake/funnel/integration/sync_output.rb +12 -8
  18. data/lib/rake/funnel/integration/teamcity/nunit_plugin.rb +61 -55
  19. data/lib/rake/funnel/integration/teamcity/progress_report.rb +39 -33
  20. data/lib/rake/funnel/integration/teamcity/service_messages.rb +46 -40
  21. data/lib/rake/funnel/integration/teamcity/teamcity.rb +19 -15
  22. data/lib/rake/funnel/integration/teamcity.rb +3 -5
  23. data/lib/rake/funnel/support/argument_mapper/key_value_pair.rb +16 -10
  24. data/lib/rake/funnel/support/argument_mapper/styles/default.rb +39 -31
  25. data/lib/rake/funnel/support/argument_mapper/styles/msbuild.rb +41 -33
  26. data/lib/rake/funnel/support/argument_mapper/styles/msdeploy.rb +55 -47
  27. data/lib/rake/funnel/support/argument_mapper/styles/nunit.rb +41 -33
  28. data/lib/rake/funnel/support/argument_mapper/styles.rb +3 -5
  29. data/lib/rake/funnel/support/argument_mapper/switch.rb +16 -10
  30. data/lib/rake/funnel/support/argument_mapper/value.rb +16 -10
  31. data/lib/rake/funnel/support/assembly_version/from_version_files.rb +39 -35
  32. data/lib/rake/funnel/support/assembly_version/languages/cs +5 -5
  33. data/lib/rake/funnel/support/assembly_version/languages/fs +12 -12
  34. data/lib/rake/funnel/support/assembly_version/languages/vb +5 -5
  35. data/lib/rake/funnel/support/assembly_version_writer.rb +56 -52
  36. data/lib/rake/funnel/support/binary_version_reader.rb +37 -32
  37. data/lib/rake/funnel/support/copier.rb +31 -27
  38. data/lib/rake/funnel/support/environments/loader.rb +46 -40
  39. data/lib/rake/funnel/support/environments.rb +3 -3
  40. data/lib/rake/funnel/support/internal/finder.rb +55 -51
  41. data/lib/rake/funnel/support/internal/instantiate_symbol.rb +38 -34
  42. data/lib/rake/funnel/support/mapper.rb +57 -53
  43. data/lib/rake/funnel/support/mono.rb +21 -17
  44. data/lib/rake/funnel/support/msbuild/build_tool.rb +30 -24
  45. data/lib/rake/funnel/support/msbuild.rb +3 -3
  46. data/lib/rake/funnel/support/msdeploy/registry_patch.rb +90 -84
  47. data/lib/rake/funnel/support/msdeploy.rb +3 -3
  48. data/lib/rake/funnel/support/patch.rb +41 -37
  49. data/lib/rake/funnel/support/specs_remover.rb +66 -62
  50. data/lib/rake/funnel/support/template_engine.rb +30 -26
  51. data/lib/rake/funnel/support/timing/report.rb +95 -89
  52. data/lib/rake/funnel/support/timing/statistics.rb +32 -26
  53. data/lib/rake/funnel/support/timing.rb +3 -3
  54. data/lib/rake/funnel/support/version_info.rb +103 -72
  55. data/lib/rake/funnel/support/which.rb +19 -15
  56. data/lib/rake/funnel/support/zipper.rb +53 -49
  57. data/lib/rake/funnel/tasks/assembly_version.rb +44 -40
  58. data/lib/rake/funnel/tasks/bin_path.rb +45 -41
  59. data/lib/rake/funnel/tasks/copy.rb +43 -39
  60. data/lib/rake/funnel/tasks/environments.rb +89 -89
  61. data/lib/rake/funnel/tasks/msbuild.rb +55 -51
  62. data/lib/rake/funnel/tasks/msdeploy.rb +54 -50
  63. data/lib/rake/funnel/tasks/nunit.rb +52 -48
  64. data/lib/rake/funnel/tasks/paket.rb +51 -47
  65. data/lib/rake/funnel/tasks/quick_template.rb +53 -49
  66. data/lib/rake/funnel/tasks/side_by_side_specs.rb +41 -37
  67. data/lib/rake/funnel/tasks/timing.rb +108 -104
  68. data/lib/rake/funnel/tasks/zip.rb +46 -42
  69. data/lib/rake/funnel/version.rb +1 -1
  70. data/lib/rake/funnel.rb +7 -7
  71. data/rake-funnel.gemspec +12 -3
  72. data/spec/rake/funnel/execution_error_spec.rb +67 -67
  73. data/spec/rake/funnel/extensions/case/camel_case_spec.rb +17 -17
  74. data/spec/rake/funnel/extensions/case/pascal_case_spec.rb +17 -17
  75. data/spec/rake/funnel/extensions/common_path_spec.rb +56 -56
  76. data/spec/rake/funnel/extensions/disable_colors_spec.rb +33 -33
  77. data/spec/rake/funnel/extensions/rexml_spec.rb +20 -20
  78. data/spec/rake/funnel/extensions/shell_spec.rb +237 -237
  79. data/spec/rake/funnel/extensions/windows_path_spec.rb +5 -5
  80. data/spec/rake/funnel/integration/progress_report_spec.rb +149 -149
  81. data/spec/rake/funnel/integration/sync_output_spec.rb +16 -16
  82. data/spec/rake/funnel/integration/teamcity/nunit_plugin_spec.rb +110 -110
  83. data/spec/rake/funnel/integration/teamcity/progress_report_spec.rb +174 -174
  84. data/spec/rake/funnel/integration/teamcity/service_messages_spec.rb +136 -136
  85. data/spec/rake/funnel/integration/teamcity/teamcity_spec.rb +34 -34
  86. data/spec/rake/funnel/support/argument_mapper/styles/msdeploy_spec.rb +222 -222
  87. data/spec/rake/funnel/support/argument_mapper/styles/nunit_spec.rb +25 -25
  88. data/spec/rake/funnel/support/argument_mapper/styles/styles_spec.rb +214 -214
  89. data/spec/rake/funnel/support/assembly_version/from_version_files_spec.rb +66 -61
  90. data/spec/rake/funnel/support/assembly_version_writer_spec.rb +140 -140
  91. data/spec/rake/funnel/support/binary_version_reader_spec.rb +29 -29
  92. data/spec/rake/funnel/support/copier_spec.rb +58 -58
  93. data/spec/rake/funnel/support/environments/loader_spec.rb +143 -143
  94. data/spec/rake/funnel/support/internal/finder_spec.rb +229 -229
  95. data/spec/rake/funnel/support/internal/instantiate_symbol_spec.rb +182 -183
  96. data/spec/rake/funnel/support/mapper_spec.rb +87 -87
  97. data/spec/rake/funnel/support/mono_spec.rb +57 -57
  98. data/spec/rake/funnel/support/msbuild/build_tool_spec.rb +21 -21
  99. data/spec/rake/funnel/support/msdeploy/registry_patch_spec.rb +139 -139
  100. data/spec/rake/funnel/support/patch_spec.rb +108 -108
  101. data/spec/rake/funnel/support/specs_remover/Sample.csproj +28 -28
  102. data/spec/rake/funnel/support/specs_remover_spec.rb +116 -116
  103. data/spec/rake/funnel/support/template_engine_spec.rb +65 -65
  104. data/spec/rake/funnel/support/timing/report_spec.rb +129 -129
  105. data/spec/rake/funnel/support/version_info_spec.rb +333 -228
  106. data/spec/rake/funnel/support/which_spec.rb +65 -65
  107. data/spec/rake/funnel/support/zipper_spec.rb +77 -77
  108. data/spec/rake/funnel/tasks/assembly_version_spec.rb +45 -45
  109. data/spec/rake/funnel/tasks/bin_path_spec.rb +52 -52
  110. data/spec/rake/funnel/tasks/copy_spec.rb +44 -44
  111. data/spec/rake/funnel/tasks/environments_spec.rb +249 -247
  112. data/spec/rake/funnel/tasks/msbuild_spec.rb +91 -91
  113. data/spec/rake/funnel/tasks/msdeploy_spec.rb +220 -220
  114. data/spec/rake/funnel/tasks/nunit_spec.rb +74 -74
  115. data/spec/rake/funnel/tasks/paket_spec.rb +140 -142
  116. data/spec/rake/funnel/tasks/quick_template_spec.rb +62 -62
  117. data/spec/rake/funnel/tasks/side_by_side_specs_spec.rb +58 -58
  118. data/spec/rake/funnel/tasks/timing_spec.rb +133 -133
  119. data/spec/rake/funnel/tasks/zip_spec.rb +50 -50
  120. data/spec/spec_helper.rb +43 -33
  121. metadata +2 -3
  122. 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