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,220 +1,220 @@
1
- include Rake
2
- include Rake::Funnel
3
- include Rake::Funnel::Support
4
- include Rake::Funnel::Support::MSDeploy
5
-
6
- describe Rake::Funnel::Tasks::MSDeploy do
7
- before {
8
- Task.clear
9
- }
10
-
11
- describe 'defaults' do
12
- its(:name) { should == :msdeploy }
13
- its(:msdeploy) { should == 'msdeploy' }
14
- its(:log_file) { should == 'msdeploy.log' }
15
- its(:args) { should == {} }
16
-
17
- context 'when task name is specified' do
18
- it 'should have a default log file equal to the task name' do
19
- expect(described_class.new(:foo).log_file).to eq('foo.log')
20
- end
21
- end
22
- end
23
-
24
- describe 'execution' do
25
- let(:msdeploy) { 'msdeploy' }
26
- let(:args) { {} }
27
-
28
- subject {
29
- described_class.new do |t|
30
- t.msdeploy = msdeploy
31
- t.args = args
32
- end
33
- }
34
-
35
- before {
36
- allow(subject).to receive(:shell)
37
-
38
- allow(RegistryPatch).to receive(:new).and_yield
39
- }
40
-
41
- describe 'argument mapping and invocation' do
42
- let(:mapper) { double(Mapper).as_null_object }
43
-
44
- before {
45
- allow(Mapper).to receive(:new).and_return(mapper)
46
- }
47
-
48
- before {
49
- Task[subject.name].invoke
50
- }
51
-
52
- it 'should use MSDeploy mapper' do
53
- expect(Mapper).to have_received(:new).with(:MSDeploy)
54
- end
55
-
56
- it 'should map arguments' do
57
- expect(mapper).to have_received(:map).with(args)
58
- end
59
-
60
- it 'should run with shell' do
61
- expect(subject).to have_received(:shell).with(/^msdeploy /,
62
- {
63
- log_file: 'msdeploy.log',
64
- error_lines: /^(error|[\w\.]*exception)/i
65
- })
66
- end
67
- end
68
-
69
- describe 'arg examples' do
70
- before {
71
- Task[subject.name].invoke
72
- }
73
-
74
- context 'skip actions' do
75
- let (:args) {
76
- {
77
- verb: :sync,
78
- source: {
79
- content_path: 'deploy'
80
- },
81
- dest: {
82
- computer_name: 'remote.example.com',
83
- username: 'bob',
84
- password: 'secret',
85
- auto: true
86
- },
87
- skip: [
88
- { directory: 'logs' },
89
- {
90
- object_name: 'filePath',
91
- skip_action: 'Delete',
92
- absolute_path: 'App_Offline\.htm$'
93
- }
94
- ],
95
- use_checksum: nil,
96
- allow_untrusted: nil
97
- }
98
- }
99
-
100
- it 'should succeed' do
101
- args = %w(
102
- msdeploy
103
- -verb:sync
104
- -source:contentPath=deploy
105
- -dest:computerName=remote.example.com,username=bob,password=secret,auto=true
106
- -skip:directory=logs
107
- -skip:objectName=filePath,skipAction=Delete,absolutePath=App_Offline\.htm$
108
- -useChecksum
109
- -allowUntrusted
110
- )
111
-
112
- expect(subject).to have_received(:shell).with(args.join(' '), be_an_instance_of(Hash))
113
- end
114
- end
115
-
116
- context 'runCommand' do
117
- let(:args) {
118
- {
119
- verb: :sync,
120
- source: {
121
- run_command: 'cd "C:\Program Files"',
122
- wait_interval: 1
123
- },
124
- dest: {
125
- computer_name: 'remote.example.com',
126
- username: 'bob',
127
- password: 'secret',
128
- auto: true
129
- }
130
- }
131
- }
132
-
133
- it 'should succeed' do
134
- args = %w(
135
- msdeploy
136
- -verb:sync
137
- -source:runCommand="cd ""C:\Program Files""",waitInterval=1
138
- -dest:computerName=remote.example.com,username=bob,password=secret,auto=true
139
- )
140
-
141
- expect(subject).to have_received(:shell).with(args.join(' '), be_an_instance_of(Hash))
142
- end
143
- end
144
-
145
- context 'preSync runCommand' do
146
- let(:args) {
147
- {
148
- verb: :sync,
149
- pre_sync: {
150
- run_command: 'cd "C:\Program Files"',
151
- dont_use_command_exe: :true
152
- },
153
- source: {
154
- content_path: 'deploy'
155
- },
156
- dest: {
157
- computer_name: 'remote.example.com',
158
- username: 'bob',
159
- password: 'secret'
160
- }
161
- }
162
- }
163
-
164
- it 'should succeed' do
165
- args = %w(
166
- msdeploy
167
- -verb:sync
168
- -preSync:runCommand="cd ""C:\Program Files""",dontUseCommandExe=true
169
- -source:contentPath=deploy
170
- -dest:computerName=remote.example.com,username=bob,password=secret
171
- )
172
-
173
- expect(subject).to have_received(:shell).with(args.join(' '), be_an_instance_of(Hash))
174
- end
175
- end
176
- end
177
-
178
- describe "MSDeploy's idiocy" do
179
- before {
180
- Task[subject.name].invoke
181
- }
182
-
183
- describe 'version registry value that is required to exist' do
184
- it 'should patch the registry' do
185
- expect(RegistryPatch).to have_received(:new)
186
- end
187
- end
188
-
189
- describe 'command line parser that requires quotes inside but not outside parameters' do
190
- let(:msdeploy) { 'path to/msdeploy' }
191
-
192
- let(:args) {
193
- {
194
- 'simple key' => 'simple value',
195
- hash: {
196
- 'hash key 1' => 'hash value 1',
197
- 'hash key 2' => 'hash value 2'
198
- },
199
- array: ['array value 1', 'array value 2'],
200
- 'some flag' => nil
201
- }
202
- }
203
-
204
- it 'should quote the string' do
205
- args = '"path to/msdeploy" -"simple key":"simple value" -hash:"hash key 1"="hash value 1","hash key 2"="hash value 2" -array:"array value 1" -array:"array value 2" -"some flag"'
206
- args = %w(
207
- "path to/msdeploy"
208
- -"simple key":"simple value"
209
- -hash:"hash key 1"="hash value 1","hash key 2"="hash value 2"
210
- -array:"array value 1"
211
- -array:"array value 2"
212
- -"some flag"
213
- ).join(' ')
214
-
215
- expect(subject).to have_received(:shell).with(args, be_an_instance_of(Hash))
216
- end
217
- end
218
- end
219
- end
220
- end
1
+ include Rake
2
+ include Rake::Funnel
3
+ include Rake::Funnel::Support
4
+ include Rake::Funnel::Support::MSDeploy
5
+
6
+ describe Rake::Funnel::Tasks::MSDeploy do
7
+ before {
8
+ Task.clear
9
+ }
10
+
11
+ describe 'defaults' do
12
+ its(:name) { should == :msdeploy }
13
+ its(:msdeploy) { should == 'msdeploy' }
14
+ its(:log_file) { should == 'msdeploy.log' }
15
+ its(:args) { should == {} }
16
+
17
+ context 'when task name is specified' do
18
+ it 'should have a default log file equal to the task name' do
19
+ expect(described_class.new(:foo).log_file).to eq('foo.log')
20
+ end
21
+ end
22
+ end
23
+
24
+ describe 'execution' do
25
+ let(:msdeploy) { 'msdeploy' }
26
+ let(:args) { {} }
27
+
28
+ subject {
29
+ described_class.new do |t|
30
+ t.msdeploy = msdeploy
31
+ t.args = args
32
+ end
33
+ }
34
+
35
+ before {
36
+ allow(subject).to receive(:shell)
37
+
38
+ allow(RegistryPatch).to receive(:new).and_yield
39
+ }
40
+
41
+ describe 'argument mapping and invocation' do
42
+ let(:mapper) { double(Mapper).as_null_object }
43
+
44
+ before {
45
+ allow(Mapper).to receive(:new).and_return(mapper)
46
+ }
47
+
48
+ before {
49
+ Task[subject.name].invoke
50
+ }
51
+
52
+ it 'should use MSDeploy mapper' do
53
+ expect(Mapper).to have_received(:new).with(:MSDeploy)
54
+ end
55
+
56
+ it 'should map arguments' do
57
+ expect(mapper).to have_received(:map).with(args)
58
+ end
59
+
60
+ it 'should run with shell' do
61
+ expect(subject).to have_received(:shell).with(/^msdeploy /,
62
+ {
63
+ log_file: 'msdeploy.log',
64
+ error_lines: /^(error|[\w\.]*exception)/i
65
+ })
66
+ end
67
+ end
68
+
69
+ describe 'arg examples' do
70
+ before {
71
+ Task[subject.name].invoke
72
+ }
73
+
74
+ context 'skip actions' do
75
+ let (:args) {
76
+ {
77
+ verb: :sync,
78
+ source: {
79
+ content_path: 'deploy'
80
+ },
81
+ dest: {
82
+ computer_name: 'remote.example.com',
83
+ username: 'bob',
84
+ password: 'secret',
85
+ auto: true
86
+ },
87
+ skip: [
88
+ { directory: 'logs' },
89
+ {
90
+ object_name: 'filePath',
91
+ skip_action: 'Delete',
92
+ absolute_path: 'App_Offline\.htm$'
93
+ }
94
+ ],
95
+ use_checksum: nil,
96
+ allow_untrusted: nil
97
+ }
98
+ }
99
+
100
+ it 'should succeed' do
101
+ args = %w(
102
+ msdeploy
103
+ -verb:sync
104
+ -source:contentPath=deploy
105
+ -dest:computerName=remote.example.com,username=bob,password=secret,auto=true
106
+ -skip:directory=logs
107
+ -skip:objectName=filePath,skipAction=Delete,absolutePath=App_Offline\.htm$
108
+ -useChecksum
109
+ -allowUntrusted
110
+ )
111
+
112
+ expect(subject).to have_received(:shell).with(args.join(' '), be_an_instance_of(Hash))
113
+ end
114
+ end
115
+
116
+ context 'runCommand' do
117
+ let(:args) {
118
+ {
119
+ verb: :sync,
120
+ source: {
121
+ run_command: 'cd "C:\Program Files"',
122
+ wait_interval: 1
123
+ },
124
+ dest: {
125
+ computer_name: 'remote.example.com',
126
+ username: 'bob',
127
+ password: 'secret',
128
+ auto: true
129
+ }
130
+ }
131
+ }
132
+
133
+ it 'should succeed' do
134
+ args = %w(
135
+ msdeploy
136
+ -verb:sync
137
+ -source:runCommand="cd ""C:\Program Files""",waitInterval=1
138
+ -dest:computerName=remote.example.com,username=bob,password=secret,auto=true
139
+ )
140
+
141
+ expect(subject).to have_received(:shell).with(args.join(' '), be_an_instance_of(Hash))
142
+ end
143
+ end
144
+
145
+ context 'preSync runCommand' do
146
+ let(:args) {
147
+ {
148
+ verb: :sync,
149
+ pre_sync: {
150
+ run_command: 'cd "C:\Program Files"',
151
+ dont_use_command_exe: :true
152
+ },
153
+ source: {
154
+ content_path: 'deploy'
155
+ },
156
+ dest: {
157
+ computer_name: 'remote.example.com',
158
+ username: 'bob',
159
+ password: 'secret'
160
+ }
161
+ }
162
+ }
163
+
164
+ it 'should succeed' do
165
+ args = %w(
166
+ msdeploy
167
+ -verb:sync
168
+ -preSync:runCommand="cd ""C:\Program Files""",dontUseCommandExe=true
169
+ -source:contentPath=deploy
170
+ -dest:computerName=remote.example.com,username=bob,password=secret
171
+ )
172
+
173
+ expect(subject).to have_received(:shell).with(args.join(' '), be_an_instance_of(Hash))
174
+ end
175
+ end
176
+ end
177
+
178
+ describe "MSDeploy's idiocy" do
179
+ before {
180
+ Task[subject.name].invoke
181
+ }
182
+
183
+ describe 'version registry value that is required to exist' do
184
+ it 'should patch the registry' do
185
+ expect(RegistryPatch).to have_received(:new)
186
+ end
187
+ end
188
+
189
+ describe 'command line parser that requires quotes inside but not outside parameters' do
190
+ let(:msdeploy) { 'path to/msdeploy' }
191
+
192
+ let(:args) {
193
+ {
194
+ 'simple key' => 'simple value',
195
+ hash: {
196
+ 'hash key 1' => 'hash value 1',
197
+ 'hash key 2' => 'hash value 2'
198
+ },
199
+ array: ['array value 1', 'array value 2'],
200
+ 'some flag' => nil
201
+ }
202
+ }
203
+
204
+ it 'should quote the string' do
205
+ args = '"path to/msdeploy" -"simple key":"simple value" -hash:"hash key 1"="hash value 1","hash key 2"="hash value 2" -array:"array value 1" -array:"array value 2" -"some flag"'
206
+ args = %w(
207
+ "path to/msdeploy"
208
+ -"simple key":"simple value"
209
+ -hash:"hash key 1"="hash value 1","hash key 2"="hash value 2"
210
+ -array:"array value 1"
211
+ -array:"array value 2"
212
+ -"some flag"
213
+ ).join(' ')
214
+
215
+ expect(subject).to have_received(:shell).with(args, be_an_instance_of(Hash))
216
+ end
217
+ end
218
+ end
219
+ end
220
+ end
@@ -1,74 +1,74 @@
1
- include Rake
2
- include Rake::Funnel
3
- include Rake::Funnel::Integration::TeamCity
4
- include Rake::Funnel::Support
5
-
6
- describe Rake::Funnel::Tasks::NUnit do
7
- before {
8
- Task.clear
9
- }
10
-
11
- describe 'defaults' do
12
- its(:name) { should == :test }
13
- its(:args) { should == {} }
14
- its(:nunit) { should == 'nunit-console.exe' }
15
- its(:files) { should == %w(build/specs/**/*.dll build/specs/**/*.exe) }
16
- end
17
-
18
- describe 'execution' do
19
- let(:args) { {} }
20
-
21
- let(:mapper) { double(Mapper).as_null_object }
22
- let(:finder) { double(Finder).as_null_object }
23
-
24
- before {
25
- allow(subject).to receive(:sh)
26
-
27
- allow(Mapper).to receive(:new).and_return(mapper)
28
- allow(Finder).to receive(:new).and_return(finder)
29
- allow(NUnitPlugin).to receive(:setup)
30
-
31
- allow(Mono).to receive(:invocation).and_wrap_original do |_original_method, *args, &_block|
32
- args.compact
33
- end
34
- }
35
-
36
- before {
37
- Task[subject.name].invoke
38
- }
39
-
40
- it 'should use test assembly finder' do
41
- expect(finder).to have_received(:all)
42
- end
43
-
44
- it 'should set up TeamCity plugin' do
45
- expect(NUnitPlugin).to have_received(:setup).with(subject.nunit)
46
- end
47
-
48
- it 'should use NUnit mapper' do
49
- expect(Mapper).to have_received(:new).with(:NUnit)
50
- end
51
-
52
- it 'should map arguments' do
53
- expect(mapper).to have_received(:map).with(args)
54
- end
55
-
56
- it 'should use mono invocation' do
57
- expect(Mono).to have_received(:invocation).with(subject.nunit)
58
- end
59
-
60
- it 'should run with sh' do
61
- expect(subject).to have_received(:sh)
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
73
- end
74
- end
1
+ include Rake
2
+ include Rake::Funnel
3
+ include Rake::Funnel::Integration::TeamCity
4
+ include Rake::Funnel::Support
5
+
6
+ describe Rake::Funnel::Tasks::NUnit do
7
+ before {
8
+ Task.clear
9
+ }
10
+
11
+ describe 'defaults' do
12
+ its(:name) { should == :test }
13
+ its(:args) { should == {} }
14
+ its(:nunit) { should == 'nunit-console.exe' }
15
+ its(:files) { should == %w(build/specs/**/*.dll build/specs/**/*.exe) }
16
+ end
17
+
18
+ describe 'execution' do
19
+ let(:args) { {} }
20
+
21
+ let(:mapper) { double(Mapper).as_null_object }
22
+ let(:finder) { double(Finder).as_null_object }
23
+
24
+ before {
25
+ allow(subject).to receive(:sh)
26
+
27
+ allow(Mapper).to receive(:new).and_return(mapper)
28
+ allow(Finder).to receive(:new).and_return(finder)
29
+ allow(NUnitPlugin).to receive(:setup)
30
+
31
+ allow(Mono).to receive(:invocation).and_wrap_original do |_original_method, *args, &_block|
32
+ args.compact
33
+ end
34
+ }
35
+
36
+ before {
37
+ Task[subject.name].invoke
38
+ }
39
+
40
+ it 'should use test assembly finder' do
41
+ expect(finder).to have_received(:all)
42
+ end
43
+
44
+ it 'should set up TeamCity plugin' do
45
+ expect(NUnitPlugin).to have_received(:setup).with(subject.nunit)
46
+ end
47
+
48
+ it 'should use NUnit mapper' do
49
+ expect(Mapper).to have_received(:new).with(:NUnit)
50
+ end
51
+
52
+ it 'should map arguments' do
53
+ expect(mapper).to have_received(:map).with(args)
54
+ end
55
+
56
+ it 'should use mono invocation' do
57
+ expect(Mono).to have_received(:invocation).with(subject.nunit)
58
+ end
59
+
60
+ it 'should run with sh' do
61
+ expect(subject).to have_received(:sh)
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
73
+ end
74
+ end