albacore 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. data/.autotest +4 -4
  2. data/.bundle/config +2 -2
  3. data/.rvmrc +1 -1
  4. data/Gemfile +12 -12
  5. data/README.markdown +92 -68
  6. data/VERSION +1 -1
  7. data/lib/albacore.rb +9 -9
  8. data/lib/albacore/albacoretask.rb +50 -50
  9. data/lib/albacore/aspnetcompiler.rb +58 -58
  10. data/lib/albacore/assemblyinfo.rb +140 -140
  11. data/lib/albacore/assemblyinfolanguages/cppcliengine.rb +17 -0
  12. data/lib/albacore/assemblyinfolanguages/csharpengine.rb +18 -18
  13. data/lib/albacore/assemblyinfolanguages/vbnetengine.rb +18 -18
  14. data/lib/albacore/config/aspnetcompilerconfig.rb +29 -29
  15. data/lib/albacore/config/assemblyinfoconfig.rb +13 -13
  16. data/lib/albacore/config/config.rb +22 -22
  17. data/lib/albacore/config/cscconfig.rb +28 -28
  18. data/lib/albacore/config/docuconfig.rb +23 -23
  19. data/lib/albacore/config/execconfig.rb +15 -15
  20. data/lib/albacore/config/fluentmigratorrunnerconfig.rb +15 -15
  21. data/lib/albacore/config/msbuildconfig.rb +29 -29
  22. data/lib/albacore/config/mspectestrunnerconfig.rb +15 -15
  23. data/lib/albacore/config/mstesttestrunnerconfig.rb +15 -15
  24. data/lib/albacore/config/nantconfig.rb +15 -15
  25. data/lib/albacore/config/nchurnconfig.rb +15 -15
  26. data/lib/albacore/config/ncoverconsoleconfig.rb +15 -15
  27. data/lib/albacore/config/ncoverreportconfig.rb +15 -15
  28. data/lib/albacore/config/ndependconfig.rb +15 -15
  29. data/lib/albacore/config/netversion.rb +21 -21
  30. data/lib/albacore/config/nugetpackconfig.rb +3 -3
  31. data/lib/albacore/config/nugetpublishconfig.rb +19 -0
  32. data/lib/albacore/config/nugetpushconfig.rb +19 -0
  33. data/lib/albacore/config/nunittestrunnerconfig.rb +14 -14
  34. data/lib/albacore/config/specflowreportconfig.rb +24 -24
  35. data/lib/albacore/config/sqlcmdconfig.rb +15 -15
  36. data/lib/albacore/config/unzipconfig.rb +15 -15
  37. data/lib/albacore/config/vssgetconfig.rb +14 -0
  38. data/lib/albacore/config/xbuildconfig.rb +15 -15
  39. data/lib/albacore/config/xunittestrunnerconfig.rb +15 -15
  40. data/lib/albacore/config/zipdirectoryconfig.rb +15 -15
  41. data/lib/albacore/csc.rb +66 -62
  42. data/lib/albacore/docu.rb +41 -41
  43. data/lib/albacore/exec.rb +18 -18
  44. data/lib/albacore/fluentmigratorrunner.rb +51 -46
  45. data/lib/albacore/msbuild.rb +55 -55
  46. data/lib/albacore/mspectestrunner.rb +50 -50
  47. data/lib/albacore/mstesttestrunner.rb +43 -43
  48. data/lib/albacore/nant.rb +38 -38
  49. data/lib/albacore/nchurn.rb +74 -74
  50. data/lib/albacore/ncoverconsole.rb +68 -68
  51. data/lib/albacore/ncoverreport.rb +62 -62
  52. data/lib/albacore/ncoverreports/assemblyfilter.rb +9 -9
  53. data/lib/albacore/ncoverreports/branchcoverage.rb +9 -9
  54. data/lib/albacore/ncoverreports/classfilter.rb +9 -9
  55. data/lib/albacore/ncoverreports/codecoveragebase.rb +25 -25
  56. data/lib/albacore/ncoverreports/cyclomaticcomplexity.rb +23 -23
  57. data/lib/albacore/ncoverreports/documentfilter.rb +9 -9
  58. data/lib/albacore/ncoverreports/fullcoveragereport.rb +13 -13
  59. data/lib/albacore/ncoverreports/methodcoverage.rb +9 -9
  60. data/lib/albacore/ncoverreports/methodfilter.rb +9 -9
  61. data/lib/albacore/ncoverreports/namespacefilter.rb +9 -9
  62. data/lib/albacore/ncoverreports/reportfilterbase.rb +26 -26
  63. data/lib/albacore/ncoverreports/summaryreport.rb +18 -18
  64. data/lib/albacore/ncoverreports/symbolcoverage.rb +9 -9
  65. data/lib/albacore/ndepend.rb +33 -33
  66. data/lib/albacore/nugetpublish.rb +47 -0
  67. data/lib/albacore/nugetpush.rb +46 -0
  68. data/lib/albacore/nunittestrunner.rb +41 -41
  69. data/lib/albacore/nuspec.rb +133 -109
  70. data/lib/albacore/output.rb +99 -99
  71. data/lib/albacore/plink.rb +47 -47
  72. data/lib/albacore/specflowreport.rb +62 -62
  73. data/lib/albacore/sqlcmd.rb +80 -80
  74. data/lib/albacore/support/attrmethods.rb +33 -33
  75. data/lib/albacore/support/createtask.rb +50 -30
  76. data/lib/albacore/support/failure.rb +15 -15
  77. data/lib/albacore/support/logging.rb +38 -38
  78. data/lib/albacore/support/openstruct.rb +13 -13
  79. data/lib/albacore/support/runcommand.rb +45 -45
  80. data/lib/albacore/support/supportlinux.rb +23 -23
  81. data/lib/albacore/support/updateattributes.rb +13 -13
  82. data/lib/albacore/support/yamlconfig.rb +18 -18
  83. data/lib/albacore/unzip.rb +28 -28
  84. data/lib/albacore/vssget.rb +44 -0
  85. data/lib/albacore/xbuild.rb +54 -54
  86. data/lib/albacore/xunittestrunner.rb +52 -52
  87. data/lib/albacore/zipdirectory.rb +105 -105
  88. data/rakefile.rb +297 -297
  89. data/spec/albacoremodel_spec.rb +53 -53
  90. data/spec/assemblyinfo_spec.rb +541 -541
  91. data/spec/attrmethods_spec.rb +136 -136
  92. data/spec/config_spec.rb +34 -34
  93. data/spec/createtask_spec.rb +236 -236
  94. data/spec/csc_spec.rb +253 -253
  95. data/spec/docu_spec.rb +109 -109
  96. data/spec/exec_spec.rb +45 -45
  97. data/spec/fluentmigratorrunner_spec.rb +254 -185
  98. data/spec/msbuild_spec.rb +215 -215
  99. data/spec/mspec_spec.rb +28 -28
  100. data/spec/mstesttestrunner_spec.rb +142 -142
  101. data/spec/nant_spec.rb +110 -110
  102. data/spec/nchurn_spec.rb +75 -75
  103. data/spec/ncoverconsole_spec.rb +353 -353
  104. data/spec/ncoverreport_spec.rb +619 -619
  105. data/spec/ndepend_spec.rb +72 -72
  106. data/spec/nunittestrunner_spec.rb +122 -122
  107. data/spec/nuspec_spec.rb +78 -78
  108. data/spec/patches/docu_patch.rb +12 -12
  109. data/spec/patches/fail_patch.rb +8 -8
  110. data/spec/patches/system_patch.rb +20 -20
  111. data/spec/plink_spec.rb +62 -62
  112. data/spec/runcommand_spec.rb +94 -94
  113. data/spec/spec_helper.rb +17 -17
  114. data/spec/specflowreport_spec.rb +146 -146
  115. data/spec/sqlcmd_spec.rb +334 -334
  116. data/spec/support/assemblyinfotester.rb +51 -51
  117. data/spec/support/ironruby_validator.rb +26 -26
  118. data/spec/support/msbuildtestdata.rb +32 -32
  119. data/spec/support/nanttestdata.rb +33 -33
  120. data/spec/support/ncoverconsoletestdata.rb +19 -19
  121. data/spec/support/ncoverreporttestdata.rb +26 -26
  122. data/spec/support/nokogiri_validator.rb +15 -15
  123. data/spec/support/outputtestdata.rb +12 -12
  124. data/spec/support/ziptestdata.rb +12 -12
  125. data/spec/unzip_spec.rb +15 -15
  126. data/spec/xbuild_spec.rb +15 -15
  127. data/spec/xunit_spec.rb +168 -168
  128. data/spec/yamlconfig_spec.rb +49 -49
  129. data/spec/zip_spec.rb +104 -104
  130. data/watchrtesting.rb +8 -8
  131. metadata +15 -119
@@ -1,619 +1,619 @@
1
- require 'spec_helper'
2
- require 'albacore/ncoverreport'
3
- require 'ncoverreporttestdata'
4
-
5
- describe NCoverReport, "when runnign without the ncover report location specified" do
6
- before :all do
7
- @ncover = NCoverReport.new
8
- @ncover.extend(FailPatch)
9
- @ncover.execute
10
- end
11
-
12
- it "should fail execution" do
13
- $task_failed.should be_true
14
- end
15
- end
16
-
17
- describe NCoverReport, "when running a full coverage report with a specified output folder" do
18
- before :all do
19
- NCoverReportTestData.clean_output_folder
20
-
21
- @ncover = NCoverReport.new
22
- @ncover.extend(SystemPatch)
23
- @ncover.log_level = :verbose
24
-
25
- @ncover.command = NCoverReportTestData.command
26
- @ncover.coverage_files NCoverReportTestData.coverage_file
27
-
28
- fullcoveragereport = NCover::FullCoverageReport.new()
29
- fullcoveragereport.output_path = NCoverReportTestData.output_folder
30
- @ncover.reports fullcoveragereport
31
-
32
- @ncover.execute
33
- end
34
-
35
- it "should execute ncover.reporting" do
36
- @ncover.system_command.should include(NCoverReportTestData.command)
37
- end
38
-
39
- it "should tell ncover.reporting to produce a full coverage html report in the specified folder" do
40
- @ncover.system_command.downcase.should include("//or FullCoverageReport:Html:\"#{NCoverReportTestData.output_folder}\"".downcase)
41
- end
42
-
43
- it "should produce the report" do
44
- File.exist?(File.join(NCoverReportTestData.output_folder, "fullcoveragereport.html")).should be_true
45
- end
46
- end
47
-
48
- describe NCoverReport, "when running a summary report with a specified output folder" do
49
- before :all do
50
- NCoverReportTestData.clean_output_folder
51
-
52
- @ncover = NCoverReport.new
53
- @ncover.extend(SystemPatch)
54
- @ncover.log_level = :verbose
55
-
56
- @ncover.command = NCoverReportTestData.command
57
- @ncover.coverage_files NCoverReportTestData.coverage_file
58
-
59
- summaryreport = NCover::SummaryReport.new()
60
- summaryreport.output_path = NCoverReportTestData.summary_output_file
61
- @ncover.reports summaryreport
62
-
63
- @ncover.execute
64
- end
65
-
66
- it "should execute ncover.reporting" do
67
- @ncover.system_command.should include(NCoverReportTestData.command)
68
- end
69
-
70
- it "should tell ncover.reporting to produce a summary html report in the specified folder" do
71
- @ncover.system_command.downcase.should include("//or Summary:Html:\"#{NCoverReportTestData.summary_output_file}\"".downcase)
72
- end
73
-
74
- it "should produce the report" do
75
- File.exist?(NCoverReportTestData.summary_output_file).should be_true
76
- end
77
- end
78
-
79
- describe NCoverReport, "when running multiple ncover reports - a summary and a full coverage report" do
80
- before :all do
81
- NCoverReportTestData.clean_output_folder
82
-
83
- @ncover = NCoverReport.new
84
- @ncover.extend(SystemPatch)
85
- @ncover.log_level = :verbose
86
-
87
- @ncover.command = NCoverReportTestData.command
88
- @ncover.coverage_files NCoverReportTestData.coverage_file
89
-
90
- summaryreport = NCover::SummaryReport.new()
91
- summaryreport.output_path = NCoverReportTestData.summary_output_file
92
-
93
- fullcoveragereport = NCover::FullCoverageReport.new()
94
- @fullcoverage_output_folder = File.join(NCoverReportTestData.output_folder, "fullcoverage")
95
- fullcoveragereport.output_path = @fullcoverage_output_folder
96
- @ncover.reports summaryreport, fullcoveragereport
97
-
98
- @ncover.execute
99
- end
100
-
101
- it "should tell ncover.reporting to produce a full coverage html report in the specified folder" do
102
- @ncover.system_command.downcase.should include("//or FullCoverageReport:Html:\"#{@fullcoverage_output_folder}\"".downcase)
103
- end
104
-
105
- it "should tell ncover.reporting to produce a summary html report in the specified folder" do
106
- @ncover.system_command.downcase.should include("//or Summary:Html:\"#{NCoverReportTestData.summary_output_file}\"".downcase)
107
- end
108
- end
109
-
110
- describe NCoverReport, "when running a report with a specified minimum symbol coverage lower than actual coverage" do
111
- before :all do
112
- NCoverReportTestData.clean_output_folder
113
-
114
- @ncover = NCoverReport.new
115
- @ncover.extend(SystemPatch)
116
- @ncover.extend(FailPatch)
117
- @ncover.log_level = :verbose
118
-
119
- @ncover.command = NCoverReportTestData.command
120
- @ncover.coverage_files NCoverReportTestData.coverage_file
121
-
122
- fullcoveragereport = NCover::FullCoverageReport.new
123
- fullcoveragereport.output_path = NCoverReportTestData.output_folder
124
- @ncover.reports fullcoveragereport
125
-
126
- symbolcoverage = NCover::SymbolCoverage.new
127
- symbolcoverage.minimum = 10
128
- @ncover.required_coverage symbolcoverage
129
-
130
- @ncover.execute
131
- end
132
-
133
- it "should tell ncover.reporting to check for the specified minimum coverage" do
134
- @ncover.system_command.should include("//mc SymbolCoverage:10:View")
135
- end
136
-
137
- it "should not fail the execution" do
138
- $task_failed.should be_false
139
- end
140
-
141
- it "should produce the report" do
142
- File.exist?(File.join(NCoverReportTestData.output_folder, "fullcoveragereport.html")).should be_true
143
- end
144
- end
145
-
146
- describe NCoverReport, "when running a report with a specified minimum symbol coverage higher than actual coverage" do
147
- before :all do
148
- NCoverReportTestData.clean_output_folder
149
-
150
- @ncover = NCoverReport.new
151
- @ncover.extend(SystemPatch)
152
- @ncover.extend(FailPatch)
153
- @ncover.log_level = :verbose
154
-
155
- @ncover.command = NCoverReportTestData.command
156
- @ncover.coverage_files NCoverReportTestData.coverage_file
157
-
158
- fullcoveragereport = NCover::FullCoverageReport.new
159
- fullcoveragereport.output_path = NCoverReportTestData.output_folder
160
- @ncover.reports fullcoveragereport
161
-
162
- symbolcoverage = NCover::SymbolCoverage.new
163
- symbolcoverage.minimum = 100
164
- @ncover.required_coverage symbolcoverage
165
-
166
- @ncover.execute
167
- end
168
-
169
- it "should tell ncover.reporting to check for the specified minimum coverage" do
170
- @ncover.system_command.should include("//mc SymbolCoverage:10")
171
- end
172
-
173
- it "should fail the execution" do
174
- $task_failed.should be_true
175
- end
176
-
177
- it "should produce the report" do
178
- File.exist?(File.join(NCoverReportTestData.output_folder, "fullcoveragereport.html")).should be_true
179
- end
180
- end
181
-
182
- describe NCoverReport, "when specifying the coverage item type to check" do
183
- before :all do
184
- NCoverReportTestData.clean_output_folder
185
-
186
- @ncover = NCoverReport.new
187
- @ncover.extend(SystemPatch)
188
- @ncover.extend(FailPatch)
189
- @ncover.log_level = :verbose
190
-
191
- @ncover.command = NCoverReportTestData.command
192
- @ncover.coverage_files NCoverReportTestData.coverage_file
193
-
194
- report = NCover::SummaryReport.new
195
- report.output_path = NCoverReportTestData.summary_output_file
196
- @ncover.reports report
197
-
198
- symbolcoverage = NCover::SymbolCoverage.new
199
- symbolcoverage.minimum = 10
200
- symbolcoverage.item_type = :Class
201
- @ncover.required_coverage symbolcoverage
202
-
203
- @ncover.execute
204
- end
205
-
206
- it "should tell ncover.reporting to check for the specified item type" do
207
- @ncover.system_command.should include("//mc SymbolCoverage:10:Class")
208
- end
209
-
210
- it "should produce the report" do
211
- File.exist?(NCoverReportTestData.summary_output_file).should be_true
212
- end
213
- end
214
-
215
- describe NCoverReport, "when checking more than one type of coverage and all fail" do
216
- before :all do
217
- NCoverReportTestData.clean_output_folder
218
-
219
- @ncover = NCoverReport.new
220
- @ncover.extend(SystemPatch)
221
- @ncover.extend(FailPatch)
222
- @ncover.log_level = :verbose
223
-
224
- @ncover.command = NCoverReportTestData.command
225
- @ncover.coverage_files NCoverReportTestData.coverage_file
226
-
227
- fullcoveragereport = NCover::FullCoverageReport.new
228
- fullcoveragereport.output_path = NCoverReportTestData.output_folder
229
- @ncover.reports fullcoveragereport
230
-
231
- @ncover.required_coverage(
232
- NCover::SymbolCoverage.new(:minimum => 100, :item_type => :View),
233
- NCover::BranchCoverage.new(:minimum => 10, :item_type => :Class),
234
- NCover::MethodCoverage.new(:minimum => 100, :item_type => :Class)
235
- )
236
-
237
- @ncover.execute
238
- end
239
-
240
- it "should tell ncover.reporting to check for the symbol coverage" do
241
- @ncover.system_command.should include("//mc SymbolCoverage:100:View")
242
- end
243
-
244
- it "should tell ncover.reporting to check for the branch coverage" do
245
- @ncover.system_command.should include("//mc BranchCoverage:10:Class")
246
- end
247
-
248
- it "should tell ncover.reporting to check for the branch coverage" do
249
- @ncover.system_command.should include("//mc MethodCoverage:100:Class")
250
- end
251
-
252
- it "should produce the report" do
253
- File.exist?(File.join(NCoverReportTestData.output_folder, "fullcoveragereport.html")).should be_true
254
- end
255
-
256
- it "should fail the execution" do
257
- $task_failed.should be_true
258
- end
259
- end
260
-
261
- describe NCoverReport, "when checking more than one type of coverage and all pass" do
262
- before :all do
263
- NCoverReportTestData.clean_output_folder
264
-
265
- @ncover = NCoverReport.new
266
- @ncover.extend(SystemPatch)
267
- @ncover.extend(FailPatch)
268
- @ncover.log_level = :verbose
269
-
270
- @ncover.command = NCoverReportTestData.command
271
- @ncover.coverage_files NCoverReportTestData.coverage_file
272
-
273
- fullcoveragereport = NCover::FullCoverageReport.new
274
- fullcoveragereport.output_path = NCoverReportTestData.output_folder
275
- @ncover.reports fullcoveragereport
276
-
277
- @ncover.required_coverage(
278
- NCover::SymbolCoverage.new(:minimum => 0, :item_type => :View),
279
- NCover::BranchCoverage.new(:minimum => 0, :item_type => :Class),
280
- NCover::MethodCoverage.new(:minimum => 0, :item_type => :Class)
281
- )
282
-
283
- @ncover.execute
284
- end
285
-
286
- it "should tell ncover.reporting to check for the symbol coverage" do
287
- @ncover.system_command.should include("//mc SymbolCoverage:0:View")
288
- end
289
-
290
- it "should tell ncover.reporting to check for the branch coverage" do
291
- @ncover.system_command.should include("//mc BranchCoverage:0:Class")
292
- end
293
-
294
- it "should tell ncover.reporting to check for the method coverage" do
295
- @ncover.system_command.should include("//mc MethodCoverage:0:Class")
296
- end
297
-
298
- it "should produce the report" do
299
- File.exist?(File.join(NCoverReportTestData.output_folder, "fullcoveragereport.html")).should be_true
300
- end
301
-
302
- it "should not fail the execution" do
303
- $task_failed.should be_false
304
- end
305
- end
306
-
307
- describe NCoverReport, "when checking more than one type of coverage and one fails" do
308
- before :all do
309
- NCoverReportTestData.clean_output_folder
310
-
311
- @ncover = NCoverReport.new
312
- @ncover.extend(SystemPatch)
313
- @ncover.extend(FailPatch)
314
- @ncover.log_level = :verbose
315
-
316
- @ncover.command = NCoverReportTestData.command
317
- @ncover.coverage_files NCoverReportTestData.coverage_file
318
-
319
- fullcoveragereport = NCover::FullCoverageReport.new
320
- fullcoveragereport.output_path = NCoverReportTestData.output_folder
321
- @ncover.reports fullcoveragereport
322
-
323
- @ncover.required_coverage(
324
- NCover::SymbolCoverage.new(:minimum => 100, :item_type => :View),
325
- NCover::BranchCoverage.new(:minimum => 0, :item_type => :Class)
326
- )
327
-
328
- @ncover.execute
329
- end
330
-
331
- it "should tell ncover.reporting to check for the symbol coverage" do
332
- @ncover.system_command.should include("//mc SymbolCoverage:100:View")
333
- end
334
-
335
- it "should tell ncover.reporting to check for the branch coverage" do
336
- @ncover.system_command.should include("//mc BranchCoverage:0:Class")
337
- end
338
-
339
- it "should produce the report" do
340
- File.exist?(File.join(NCoverReportTestData.output_folder, "fullcoveragereport.html")).should be_true
341
- end
342
-
343
- it "should fail the execution" do
344
- $task_failed.should be_true
345
- end
346
- end
347
-
348
- describe NCoverReport, "when running a report with a cyclomatic complexity higher than allowed" do
349
- before :all do
350
- NCoverReportTestData.clean_output_folder
351
-
352
- @ncover = NCoverReport.new
353
- @ncover.extend(SystemPatch)
354
- @ncover.extend(FailPatch)
355
- @ncover.log_level = :verbose
356
-
357
- @ncover.command = NCoverReportTestData.command
358
- @ncover.coverage_files NCoverReportTestData.coverage_file
359
-
360
- fullcoveragereport = NCover::FullCoverageReport.new
361
- fullcoveragereport.output_path = NCoverReportTestData.output_folder
362
- @ncover.reports fullcoveragereport
363
-
364
- coverage = NCover::CyclomaticComplexity.new(:maximum => 1, :item_type => :Class)
365
- @ncover.required_coverage coverage
366
-
367
- @ncover.execute
368
- end
369
-
370
- it "should tell ncover.reporting to check for the maximum cyclomatic complexity" do
371
- @ncover.system_command.should include("//mc CyclomaticComplexity:1:Class")
372
- end
373
-
374
- it "should fail the execution" do
375
- $task_failed.should be_true
376
- end
377
-
378
- it "should produce the report" do
379
- File.exist?(File.join(NCoverReportTestData.output_folder, "fullcoveragereport.html")).should be_true
380
- end
381
- end
382
-
383
- describe NCoverReport, "when running a report with a cyclomatic complexity under the limit" do
384
- before :all do
385
- NCoverReportTestData.clean_output_folder
386
-
387
- @ncover = NCoverReport.new
388
- @ncover.extend(SystemPatch)
389
- @ncover.extend(FailPatch)
390
- @ncover.log_level = :verbose
391
-
392
- @ncover.command = NCoverReportTestData.command
393
- @ncover.coverage_files NCoverReportTestData.coverage_file
394
-
395
- fullcoveragereport = NCover::FullCoverageReport.new
396
- fullcoveragereport.output_path = NCoverReportTestData.output_folder
397
- @ncover.reports fullcoveragereport
398
-
399
- coverage = NCover::CyclomaticComplexity.new(:maximum => 1000)
400
- @ncover.required_coverage coverage
401
-
402
- @ncover.execute
403
- end
404
-
405
- it "should tell ncover.reporting to check for the maximum cyclomatic complexity" do
406
- @ncover.system_command.should include("//mc CyclomaticComplexity:1000:View")
407
- end
408
-
409
- it "should not fail the execution" do
410
- $task_failed.should be_false
411
- end
412
-
413
- it "should produce the report" do
414
- File.exist?(File.join(NCoverReportTestData.output_folder, "fullcoveragereport.html")).should be_true
415
- end
416
- end
417
-
418
- describe NCoverReport, "when filtering on Assembly coverage data" do
419
- before :all do
420
- NCoverReportTestData.clean_output_folder
421
-
422
- @ncover = NCoverReport.new
423
- @ncover.extend(SystemPatch)
424
- @ncover.extend(FailPatch)
425
- @ncover.log_level = :verbose
426
-
427
- @ncover.command = NCoverReportTestData.command
428
- @ncover.coverage_files NCoverReportTestData.coverage_file
429
-
430
- fullcoveragereport = NCover::FullCoverageReport.new
431
- fullcoveragereport.output_path = NCoverReportTestData.output_folder
432
- @ncover.reports fullcoveragereport
433
- @ncover.required_coverage NCover::SymbolCoverage.new(:minimum => 0)
434
-
435
- @ncover.filters(
436
- NCover::AssemblyFilter.new(:filter_type => :exclude, :filter => "nunit.*"),
437
- NCover::AssemblyFilter.new(:filter_type => :include, :filter => "TestSolution.*")
438
- )
439
-
440
- @ncover.execute
441
- end
442
-
443
- it "should exclude the specified assemblies data" do
444
- @ncover.system_command.should include("//cf \"nunit.*\":Assembly:false:false")
445
- end
446
-
447
- it "should include the specified assemblies data" do
448
- @ncover.system_command.should include("//cf \"TestSolution.*\":Assembly:false:true")
449
- end
450
-
451
- it "should not fail" do
452
- $task_failed.should be_false
453
- end
454
- end
455
-
456
- describe NCoverReport, "when filtering on Namespace coverage data" do
457
- before :all do
458
- NCoverReportTestData.clean_output_folder
459
-
460
- @ncover = NCoverReport.new
461
- @ncover.extend(SystemPatch)
462
- @ncover.extend(FailPatch)
463
- @ncover.log_level = :verbose
464
-
465
- @ncover.command = NCoverReportTestData.command
466
- @ncover.coverage_files NCoverReportTestData.coverage_file
467
-
468
- fullcoveragereport = NCover::FullCoverageReport.new
469
- fullcoveragereport.output_path = NCoverReportTestData.output_folder
470
- @ncover.reports fullcoveragereport
471
- @ncover.required_coverage NCover::SymbolCoverage.new(:minimum => 0)
472
-
473
- @ncover.filters(
474
- NCover::NamespaceFilter.new(:filter_type => :exclude, :filter => "nunit.*"),
475
- NCover::NamespaceFilter.new(:filter_type => :include, :filter => "TestSolution.*")
476
- )
477
-
478
- @ncover.execute
479
- end
480
-
481
- it "should exclude the specified data" do
482
- @ncover.system_command.should include("//cf \"nunit.*\":Namespace:false:false")
483
- end
484
-
485
- it "should include the specified data" do
486
- @ncover.system_command.should include("//cf \"TestSolution.*\":Namespace:false:true")
487
- end
488
-
489
- it "should not fail" do
490
- $task_failed.should be_false
491
- end
492
- end
493
-
494
- describe NCoverReport, "when filtering on Class coverage data" do
495
- before :all do
496
- NCoverReportTestData.clean_output_folder
497
-
498
- @ncover = NCoverReport.new
499
- @ncover.extend(SystemPatch)
500
- @ncover.extend(FailPatch)
501
- @ncover.log_level = :verbose
502
-
503
- @ncover.command = NCoverReportTestData.command
504
- @ncover.coverage_files NCoverReportTestData.coverage_file
505
-
506
- fullcoveragereport = NCover::FullCoverageReport.new
507
- fullcoveragereport.output_path = NCoverReportTestData.output_folder
508
- @ncover.reports fullcoveragereport
509
- @ncover.required_coverage NCover::SymbolCoverage.new(:minimum => 0)
510
-
511
- @ncover.filters(
512
- NCover::ClassFilter.new(:filter_type => :exclude, :filter => "Foo"),
513
- NCover::ClassFilter.new(:filter_type => :include, :filter => "Bar")
514
- )
515
-
516
- @ncover.execute
517
- end
518
-
519
- it "should exclude the specified data" do
520
- @ncover.system_command.should include("//cf \"Foo\":Class:false:false")
521
- end
522
-
523
- it "should include the specified data" do
524
- @ncover.system_command.should include("//cf \"Bar\":Class:false:true")
525
- end
526
-
527
- it "should not fail" do
528
- $task_failed.should be_false
529
- end
530
- end
531
-
532
- describe NCoverReport, "when filtering on Method coverage data" do
533
- before :all do
534
- NCoverReportTestData.clean_output_folder
535
-
536
- @ncover = NCoverReport.new
537
- @ncover.extend(SystemPatch)
538
- @ncover.extend(FailPatch)
539
- @ncover.log_level = :verbose
540
-
541
- @ncover.command = NCoverReportTestData.command
542
- @ncover.coverage_files NCoverReportTestData.coverage_file
543
-
544
- fullcoveragereport = NCover::FullCoverageReport.new
545
- fullcoveragereport.output_path = NCoverReportTestData.output_folder
546
- @ncover.reports fullcoveragereport
547
- @ncover.required_coverage NCover::SymbolCoverage.new(:minimum => 0)
548
-
549
- @ncover.filters(
550
- NCover::MethodFilter.new(:filter_type => :exclude, :filter => "Foo"),
551
- NCover::MethodFilter.new(:filter_type => :include, :filter => "Bar")
552
- )
553
-
554
- @ncover.execute
555
- end
556
-
557
- it "should exclude the specified data" do
558
- @ncover.system_command.should include("//cf \"Foo\":Method:false:false")
559
- end
560
-
561
- it "should include the specified data" do
562
- @ncover.system_command.should include("//cf \"Bar\":Method:false:true")
563
- end
564
-
565
- it "should not fail" do
566
- $task_failed.should be_false
567
- end
568
- end
569
-
570
- describe NCoverReport, "when filtering on Document coverage data" do
571
- before :all do
572
- NCoverReportTestData.clean_output_folder
573
-
574
- @ncover = NCoverReport.new
575
- @ncover.extend(SystemPatch)
576
- @ncover.extend(FailPatch)
577
- @ncover.log_level = :verbose
578
-
579
- @ncover.command = NCoverReportTestData.command
580
- @ncover.coverage_files NCoverReportTestData.coverage_file
581
-
582
- fullcoveragereport = NCover::FullCoverageReport.new
583
- fullcoveragereport.output_path = NCoverReportTestData.output_folder
584
- @ncover.reports fullcoveragereport
585
- @ncover.required_coverage NCover::SymbolCoverage.new(:minimum => 0)
586
-
587
- @ncover.filters(
588
- NCover::DocumentFilter.new(:filter_type => :exclude, :filter => "Foo"),
589
- NCover::DocumentFilter.new(:filter_type => :include, :filter => "Bar")
590
- )
591
-
592
- @ncover.execute
593
- end
594
-
595
- it "should exclude the specified data" do
596
- @ncover.system_command.should include("//cf \"Foo\":Document:false:false")
597
- end
598
-
599
- it "should include the specified data" do
600
- @ncover.system_command.should include("//cf \"Bar\":Document:false:true")
601
- end
602
-
603
- it "should not fail" do
604
- $task_failed.should be_false
605
- end
606
- end
607
-
608
- describe NCoverReport, "when providing configuration values" do
609
- let :ncoverreport do
610
- Albacore.configure do |config|
611
- config.ncoverreport.command = "configured"
612
- end
613
- ncoverreport = NCoverReport.new
614
- end
615
-
616
- it "should use the configured values" do
617
- ncoverreport.command.should == "configured"
618
- end
619
- end
1
+ require 'spec_helper'
2
+ require 'albacore/ncoverreport'
3
+ require 'ncoverreporttestdata'
4
+
5
+ describe NCoverReport, "when runnign without the ncover report location specified" do
6
+ before :all do
7
+ @ncover = NCoverReport.new
8
+ @ncover.extend(FailPatch)
9
+ @ncover.execute
10
+ end
11
+
12
+ it "should fail execution" do
13
+ $task_failed.should be_true
14
+ end
15
+ end
16
+
17
+ describe NCoverReport, "when running a full coverage report with a specified output folder" do
18
+ before :all do
19
+ NCoverReportTestData.clean_output_folder
20
+
21
+ @ncover = NCoverReport.new
22
+ @ncover.extend(SystemPatch)
23
+ @ncover.log_level = :verbose
24
+
25
+ @ncover.command = NCoverReportTestData.command
26
+ @ncover.coverage_files NCoverReportTestData.coverage_file
27
+
28
+ fullcoveragereport = NCover::FullCoverageReport.new()
29
+ fullcoveragereport.output_path = NCoverReportTestData.output_folder
30
+ @ncover.reports fullcoveragereport
31
+
32
+ @ncover.execute
33
+ end
34
+
35
+ it "should execute ncover.reporting" do
36
+ @ncover.system_command.should include(NCoverReportTestData.command)
37
+ end
38
+
39
+ it "should tell ncover.reporting to produce a full coverage html report in the specified folder" do
40
+ @ncover.system_command.downcase.should include("//or FullCoverageReport:Html:\"#{NCoverReportTestData.output_folder}\"".downcase)
41
+ end
42
+
43
+ it "should produce the report" do
44
+ File.exist?(File.join(NCoverReportTestData.output_folder, "fullcoveragereport.html")).should be_true
45
+ end
46
+ end
47
+
48
+ describe NCoverReport, "when running a summary report with a specified output folder" do
49
+ before :all do
50
+ NCoverReportTestData.clean_output_folder
51
+
52
+ @ncover = NCoverReport.new
53
+ @ncover.extend(SystemPatch)
54
+ @ncover.log_level = :verbose
55
+
56
+ @ncover.command = NCoverReportTestData.command
57
+ @ncover.coverage_files NCoverReportTestData.coverage_file
58
+
59
+ summaryreport = NCover::SummaryReport.new()
60
+ summaryreport.output_path = NCoverReportTestData.summary_output_file
61
+ @ncover.reports summaryreport
62
+
63
+ @ncover.execute
64
+ end
65
+
66
+ it "should execute ncover.reporting" do
67
+ @ncover.system_command.should include(NCoverReportTestData.command)
68
+ end
69
+
70
+ it "should tell ncover.reporting to produce a summary html report in the specified folder" do
71
+ @ncover.system_command.downcase.should include("//or Summary:Html:\"#{NCoverReportTestData.summary_output_file}\"".downcase)
72
+ end
73
+
74
+ it "should produce the report" do
75
+ File.exist?(NCoverReportTestData.summary_output_file).should be_true
76
+ end
77
+ end
78
+
79
+ describe NCoverReport, "when running multiple ncover reports - a summary and a full coverage report" do
80
+ before :all do
81
+ NCoverReportTestData.clean_output_folder
82
+
83
+ @ncover = NCoverReport.new
84
+ @ncover.extend(SystemPatch)
85
+ @ncover.log_level = :verbose
86
+
87
+ @ncover.command = NCoverReportTestData.command
88
+ @ncover.coverage_files NCoverReportTestData.coverage_file
89
+
90
+ summaryreport = NCover::SummaryReport.new()
91
+ summaryreport.output_path = NCoverReportTestData.summary_output_file
92
+
93
+ fullcoveragereport = NCover::FullCoverageReport.new()
94
+ @fullcoverage_output_folder = File.join(NCoverReportTestData.output_folder, "fullcoverage")
95
+ fullcoveragereport.output_path = @fullcoverage_output_folder
96
+ @ncover.reports summaryreport, fullcoveragereport
97
+
98
+ @ncover.execute
99
+ end
100
+
101
+ it "should tell ncover.reporting to produce a full coverage html report in the specified folder" do
102
+ @ncover.system_command.downcase.should include("//or FullCoverageReport:Html:\"#{@fullcoverage_output_folder}\"".downcase)
103
+ end
104
+
105
+ it "should tell ncover.reporting to produce a summary html report in the specified folder" do
106
+ @ncover.system_command.downcase.should include("//or Summary:Html:\"#{NCoverReportTestData.summary_output_file}\"".downcase)
107
+ end
108
+ end
109
+
110
+ describe NCoverReport, "when running a report with a specified minimum symbol coverage lower than actual coverage" do
111
+ before :all do
112
+ NCoverReportTestData.clean_output_folder
113
+
114
+ @ncover = NCoverReport.new
115
+ @ncover.extend(SystemPatch)
116
+ @ncover.extend(FailPatch)
117
+ @ncover.log_level = :verbose
118
+
119
+ @ncover.command = NCoverReportTestData.command
120
+ @ncover.coverage_files NCoverReportTestData.coverage_file
121
+
122
+ fullcoveragereport = NCover::FullCoverageReport.new
123
+ fullcoveragereport.output_path = NCoverReportTestData.output_folder
124
+ @ncover.reports fullcoveragereport
125
+
126
+ symbolcoverage = NCover::SymbolCoverage.new
127
+ symbolcoverage.minimum = 10
128
+ @ncover.required_coverage symbolcoverage
129
+
130
+ @ncover.execute
131
+ end
132
+
133
+ it "should tell ncover.reporting to check for the specified minimum coverage" do
134
+ @ncover.system_command.should include("//mc SymbolCoverage:10:View")
135
+ end
136
+
137
+ it "should not fail the execution" do
138
+ $task_failed.should be_false
139
+ end
140
+
141
+ it "should produce the report" do
142
+ File.exist?(File.join(NCoverReportTestData.output_folder, "fullcoveragereport.html")).should be_true
143
+ end
144
+ end
145
+
146
+ describe NCoverReport, "when running a report with a specified minimum symbol coverage higher than actual coverage" do
147
+ before :all do
148
+ NCoverReportTestData.clean_output_folder
149
+
150
+ @ncover = NCoverReport.new
151
+ @ncover.extend(SystemPatch)
152
+ @ncover.extend(FailPatch)
153
+ @ncover.log_level = :verbose
154
+
155
+ @ncover.command = NCoverReportTestData.command
156
+ @ncover.coverage_files NCoverReportTestData.coverage_file
157
+
158
+ fullcoveragereport = NCover::FullCoverageReport.new
159
+ fullcoveragereport.output_path = NCoverReportTestData.output_folder
160
+ @ncover.reports fullcoveragereport
161
+
162
+ symbolcoverage = NCover::SymbolCoverage.new
163
+ symbolcoverage.minimum = 100
164
+ @ncover.required_coverage symbolcoverage
165
+
166
+ @ncover.execute
167
+ end
168
+
169
+ it "should tell ncover.reporting to check for the specified minimum coverage" do
170
+ @ncover.system_command.should include("//mc SymbolCoverage:10")
171
+ end
172
+
173
+ it "should fail the execution" do
174
+ $task_failed.should be_true
175
+ end
176
+
177
+ it "should produce the report" do
178
+ File.exist?(File.join(NCoverReportTestData.output_folder, "fullcoveragereport.html")).should be_true
179
+ end
180
+ end
181
+
182
+ describe NCoverReport, "when specifying the coverage item type to check" do
183
+ before :all do
184
+ NCoverReportTestData.clean_output_folder
185
+
186
+ @ncover = NCoverReport.new
187
+ @ncover.extend(SystemPatch)
188
+ @ncover.extend(FailPatch)
189
+ @ncover.log_level = :verbose
190
+
191
+ @ncover.command = NCoverReportTestData.command
192
+ @ncover.coverage_files NCoverReportTestData.coverage_file
193
+
194
+ report = NCover::SummaryReport.new
195
+ report.output_path = NCoverReportTestData.summary_output_file
196
+ @ncover.reports report
197
+
198
+ symbolcoverage = NCover::SymbolCoverage.new
199
+ symbolcoverage.minimum = 10
200
+ symbolcoverage.item_type = :Class
201
+ @ncover.required_coverage symbolcoverage
202
+
203
+ @ncover.execute
204
+ end
205
+
206
+ it "should tell ncover.reporting to check for the specified item type" do
207
+ @ncover.system_command.should include("//mc SymbolCoverage:10:Class")
208
+ end
209
+
210
+ it "should produce the report" do
211
+ File.exist?(NCoverReportTestData.summary_output_file).should be_true
212
+ end
213
+ end
214
+
215
+ describe NCoverReport, "when checking more than one type of coverage and all fail" do
216
+ before :all do
217
+ NCoverReportTestData.clean_output_folder
218
+
219
+ @ncover = NCoverReport.new
220
+ @ncover.extend(SystemPatch)
221
+ @ncover.extend(FailPatch)
222
+ @ncover.log_level = :verbose
223
+
224
+ @ncover.command = NCoverReportTestData.command
225
+ @ncover.coverage_files NCoverReportTestData.coverage_file
226
+
227
+ fullcoveragereport = NCover::FullCoverageReport.new
228
+ fullcoveragereport.output_path = NCoverReportTestData.output_folder
229
+ @ncover.reports fullcoveragereport
230
+
231
+ @ncover.required_coverage(
232
+ NCover::SymbolCoverage.new(:minimum => 100, :item_type => :View),
233
+ NCover::BranchCoverage.new(:minimum => 10, :item_type => :Class),
234
+ NCover::MethodCoverage.new(:minimum => 100, :item_type => :Class)
235
+ )
236
+
237
+ @ncover.execute
238
+ end
239
+
240
+ it "should tell ncover.reporting to check for the symbol coverage" do
241
+ @ncover.system_command.should include("//mc SymbolCoverage:100:View")
242
+ end
243
+
244
+ it "should tell ncover.reporting to check for the branch coverage" do
245
+ @ncover.system_command.should include("//mc BranchCoverage:10:Class")
246
+ end
247
+
248
+ it "should tell ncover.reporting to check for the branch coverage" do
249
+ @ncover.system_command.should include("//mc MethodCoverage:100:Class")
250
+ end
251
+
252
+ it "should produce the report" do
253
+ File.exist?(File.join(NCoverReportTestData.output_folder, "fullcoveragereport.html")).should be_true
254
+ end
255
+
256
+ it "should fail the execution" do
257
+ $task_failed.should be_true
258
+ end
259
+ end
260
+
261
+ describe NCoverReport, "when checking more than one type of coverage and all pass" do
262
+ before :all do
263
+ NCoverReportTestData.clean_output_folder
264
+
265
+ @ncover = NCoverReport.new
266
+ @ncover.extend(SystemPatch)
267
+ @ncover.extend(FailPatch)
268
+ @ncover.log_level = :verbose
269
+
270
+ @ncover.command = NCoverReportTestData.command
271
+ @ncover.coverage_files NCoverReportTestData.coverage_file
272
+
273
+ fullcoveragereport = NCover::FullCoverageReport.new
274
+ fullcoveragereport.output_path = NCoverReportTestData.output_folder
275
+ @ncover.reports fullcoveragereport
276
+
277
+ @ncover.required_coverage(
278
+ NCover::SymbolCoverage.new(:minimum => 0, :item_type => :View),
279
+ NCover::BranchCoverage.new(:minimum => 0, :item_type => :Class),
280
+ NCover::MethodCoverage.new(:minimum => 0, :item_type => :Class)
281
+ )
282
+
283
+ @ncover.execute
284
+ end
285
+
286
+ it "should tell ncover.reporting to check for the symbol coverage" do
287
+ @ncover.system_command.should include("//mc SymbolCoverage:0:View")
288
+ end
289
+
290
+ it "should tell ncover.reporting to check for the branch coverage" do
291
+ @ncover.system_command.should include("//mc BranchCoverage:0:Class")
292
+ end
293
+
294
+ it "should tell ncover.reporting to check for the method coverage" do
295
+ @ncover.system_command.should include("//mc MethodCoverage:0:Class")
296
+ end
297
+
298
+ it "should produce the report" do
299
+ File.exist?(File.join(NCoverReportTestData.output_folder, "fullcoveragereport.html")).should be_true
300
+ end
301
+
302
+ it "should not fail the execution" do
303
+ $task_failed.should be_false
304
+ end
305
+ end
306
+
307
+ describe NCoverReport, "when checking more than one type of coverage and one fails" do
308
+ before :all do
309
+ NCoverReportTestData.clean_output_folder
310
+
311
+ @ncover = NCoverReport.new
312
+ @ncover.extend(SystemPatch)
313
+ @ncover.extend(FailPatch)
314
+ @ncover.log_level = :verbose
315
+
316
+ @ncover.command = NCoverReportTestData.command
317
+ @ncover.coverage_files NCoverReportTestData.coverage_file
318
+
319
+ fullcoveragereport = NCover::FullCoverageReport.new
320
+ fullcoveragereport.output_path = NCoverReportTestData.output_folder
321
+ @ncover.reports fullcoveragereport
322
+
323
+ @ncover.required_coverage(
324
+ NCover::SymbolCoverage.new(:minimum => 100, :item_type => :View),
325
+ NCover::BranchCoverage.new(:minimum => 0, :item_type => :Class)
326
+ )
327
+
328
+ @ncover.execute
329
+ end
330
+
331
+ it "should tell ncover.reporting to check for the symbol coverage" do
332
+ @ncover.system_command.should include("//mc SymbolCoverage:100:View")
333
+ end
334
+
335
+ it "should tell ncover.reporting to check for the branch coverage" do
336
+ @ncover.system_command.should include("//mc BranchCoverage:0:Class")
337
+ end
338
+
339
+ it "should produce the report" do
340
+ File.exist?(File.join(NCoverReportTestData.output_folder, "fullcoveragereport.html")).should be_true
341
+ end
342
+
343
+ it "should fail the execution" do
344
+ $task_failed.should be_true
345
+ end
346
+ end
347
+
348
+ describe NCoverReport, "when running a report with a cyclomatic complexity higher than allowed" do
349
+ before :all do
350
+ NCoverReportTestData.clean_output_folder
351
+
352
+ @ncover = NCoverReport.new
353
+ @ncover.extend(SystemPatch)
354
+ @ncover.extend(FailPatch)
355
+ @ncover.log_level = :verbose
356
+
357
+ @ncover.command = NCoverReportTestData.command
358
+ @ncover.coverage_files NCoverReportTestData.coverage_file
359
+
360
+ fullcoveragereport = NCover::FullCoverageReport.new
361
+ fullcoveragereport.output_path = NCoverReportTestData.output_folder
362
+ @ncover.reports fullcoveragereport
363
+
364
+ coverage = NCover::CyclomaticComplexity.new(:maximum => 1, :item_type => :Class)
365
+ @ncover.required_coverage coverage
366
+
367
+ @ncover.execute
368
+ end
369
+
370
+ it "should tell ncover.reporting to check for the maximum cyclomatic complexity" do
371
+ @ncover.system_command.should include("//mc CyclomaticComplexity:1:Class")
372
+ end
373
+
374
+ it "should fail the execution" do
375
+ $task_failed.should be_true
376
+ end
377
+
378
+ it "should produce the report" do
379
+ File.exist?(File.join(NCoverReportTestData.output_folder, "fullcoveragereport.html")).should be_true
380
+ end
381
+ end
382
+
383
+ describe NCoverReport, "when running a report with a cyclomatic complexity under the limit" do
384
+ before :all do
385
+ NCoverReportTestData.clean_output_folder
386
+
387
+ @ncover = NCoverReport.new
388
+ @ncover.extend(SystemPatch)
389
+ @ncover.extend(FailPatch)
390
+ @ncover.log_level = :verbose
391
+
392
+ @ncover.command = NCoverReportTestData.command
393
+ @ncover.coverage_files NCoverReportTestData.coverage_file
394
+
395
+ fullcoveragereport = NCover::FullCoverageReport.new
396
+ fullcoveragereport.output_path = NCoverReportTestData.output_folder
397
+ @ncover.reports fullcoveragereport
398
+
399
+ coverage = NCover::CyclomaticComplexity.new(:maximum => 1000)
400
+ @ncover.required_coverage coverage
401
+
402
+ @ncover.execute
403
+ end
404
+
405
+ it "should tell ncover.reporting to check for the maximum cyclomatic complexity" do
406
+ @ncover.system_command.should include("//mc CyclomaticComplexity:1000:View")
407
+ end
408
+
409
+ it "should not fail the execution" do
410
+ $task_failed.should be_false
411
+ end
412
+
413
+ it "should produce the report" do
414
+ File.exist?(File.join(NCoverReportTestData.output_folder, "fullcoveragereport.html")).should be_true
415
+ end
416
+ end
417
+
418
+ describe NCoverReport, "when filtering on Assembly coverage data" do
419
+ before :all do
420
+ NCoverReportTestData.clean_output_folder
421
+
422
+ @ncover = NCoverReport.new
423
+ @ncover.extend(SystemPatch)
424
+ @ncover.extend(FailPatch)
425
+ @ncover.log_level = :verbose
426
+
427
+ @ncover.command = NCoverReportTestData.command
428
+ @ncover.coverage_files NCoverReportTestData.coverage_file
429
+
430
+ fullcoveragereport = NCover::FullCoverageReport.new
431
+ fullcoveragereport.output_path = NCoverReportTestData.output_folder
432
+ @ncover.reports fullcoveragereport
433
+ @ncover.required_coverage NCover::SymbolCoverage.new(:minimum => 0)
434
+
435
+ @ncover.filters(
436
+ NCover::AssemblyFilter.new(:filter_type => :exclude, :filter => "nunit.*"),
437
+ NCover::AssemblyFilter.new(:filter_type => :include, :filter => "TestSolution.*")
438
+ )
439
+
440
+ @ncover.execute
441
+ end
442
+
443
+ it "should exclude the specified assemblies data" do
444
+ @ncover.system_command.should include("//cf \"nunit.*\":Assembly:false:false")
445
+ end
446
+
447
+ it "should include the specified assemblies data" do
448
+ @ncover.system_command.should include("//cf \"TestSolution.*\":Assembly:false:true")
449
+ end
450
+
451
+ it "should not fail" do
452
+ $task_failed.should be_false
453
+ end
454
+ end
455
+
456
+ describe NCoverReport, "when filtering on Namespace coverage data" do
457
+ before :all do
458
+ NCoverReportTestData.clean_output_folder
459
+
460
+ @ncover = NCoverReport.new
461
+ @ncover.extend(SystemPatch)
462
+ @ncover.extend(FailPatch)
463
+ @ncover.log_level = :verbose
464
+
465
+ @ncover.command = NCoverReportTestData.command
466
+ @ncover.coverage_files NCoverReportTestData.coverage_file
467
+
468
+ fullcoveragereport = NCover::FullCoverageReport.new
469
+ fullcoveragereport.output_path = NCoverReportTestData.output_folder
470
+ @ncover.reports fullcoveragereport
471
+ @ncover.required_coverage NCover::SymbolCoverage.new(:minimum => 0)
472
+
473
+ @ncover.filters(
474
+ NCover::NamespaceFilter.new(:filter_type => :exclude, :filter => "nunit.*"),
475
+ NCover::NamespaceFilter.new(:filter_type => :include, :filter => "TestSolution.*")
476
+ )
477
+
478
+ @ncover.execute
479
+ end
480
+
481
+ it "should exclude the specified data" do
482
+ @ncover.system_command.should include("//cf \"nunit.*\":Namespace:false:false")
483
+ end
484
+
485
+ it "should include the specified data" do
486
+ @ncover.system_command.should include("//cf \"TestSolution.*\":Namespace:false:true")
487
+ end
488
+
489
+ it "should not fail" do
490
+ $task_failed.should be_false
491
+ end
492
+ end
493
+
494
+ describe NCoverReport, "when filtering on Class coverage data" do
495
+ before :all do
496
+ NCoverReportTestData.clean_output_folder
497
+
498
+ @ncover = NCoverReport.new
499
+ @ncover.extend(SystemPatch)
500
+ @ncover.extend(FailPatch)
501
+ @ncover.log_level = :verbose
502
+
503
+ @ncover.command = NCoverReportTestData.command
504
+ @ncover.coverage_files NCoverReportTestData.coverage_file
505
+
506
+ fullcoveragereport = NCover::FullCoverageReport.new
507
+ fullcoveragereport.output_path = NCoverReportTestData.output_folder
508
+ @ncover.reports fullcoveragereport
509
+ @ncover.required_coverage NCover::SymbolCoverage.new(:minimum => 0)
510
+
511
+ @ncover.filters(
512
+ NCover::ClassFilter.new(:filter_type => :exclude, :filter => "Foo"),
513
+ NCover::ClassFilter.new(:filter_type => :include, :filter => "Bar")
514
+ )
515
+
516
+ @ncover.execute
517
+ end
518
+
519
+ it "should exclude the specified data" do
520
+ @ncover.system_command.should include("//cf \"Foo\":Class:false:false")
521
+ end
522
+
523
+ it "should include the specified data" do
524
+ @ncover.system_command.should include("//cf \"Bar\":Class:false:true")
525
+ end
526
+
527
+ it "should not fail" do
528
+ $task_failed.should be_false
529
+ end
530
+ end
531
+
532
+ describe NCoverReport, "when filtering on Method coverage data" do
533
+ before :all do
534
+ NCoverReportTestData.clean_output_folder
535
+
536
+ @ncover = NCoverReport.new
537
+ @ncover.extend(SystemPatch)
538
+ @ncover.extend(FailPatch)
539
+ @ncover.log_level = :verbose
540
+
541
+ @ncover.command = NCoverReportTestData.command
542
+ @ncover.coverage_files NCoverReportTestData.coverage_file
543
+
544
+ fullcoveragereport = NCover::FullCoverageReport.new
545
+ fullcoveragereport.output_path = NCoverReportTestData.output_folder
546
+ @ncover.reports fullcoveragereport
547
+ @ncover.required_coverage NCover::SymbolCoverage.new(:minimum => 0)
548
+
549
+ @ncover.filters(
550
+ NCover::MethodFilter.new(:filter_type => :exclude, :filter => "Foo"),
551
+ NCover::MethodFilter.new(:filter_type => :include, :filter => "Bar")
552
+ )
553
+
554
+ @ncover.execute
555
+ end
556
+
557
+ it "should exclude the specified data" do
558
+ @ncover.system_command.should include("//cf \"Foo\":Method:false:false")
559
+ end
560
+
561
+ it "should include the specified data" do
562
+ @ncover.system_command.should include("//cf \"Bar\":Method:false:true")
563
+ end
564
+
565
+ it "should not fail" do
566
+ $task_failed.should be_false
567
+ end
568
+ end
569
+
570
+ describe NCoverReport, "when filtering on Document coverage data" do
571
+ before :all do
572
+ NCoverReportTestData.clean_output_folder
573
+
574
+ @ncover = NCoverReport.new
575
+ @ncover.extend(SystemPatch)
576
+ @ncover.extend(FailPatch)
577
+ @ncover.log_level = :verbose
578
+
579
+ @ncover.command = NCoverReportTestData.command
580
+ @ncover.coverage_files NCoverReportTestData.coverage_file
581
+
582
+ fullcoveragereport = NCover::FullCoverageReport.new
583
+ fullcoveragereport.output_path = NCoverReportTestData.output_folder
584
+ @ncover.reports fullcoveragereport
585
+ @ncover.required_coverage NCover::SymbolCoverage.new(:minimum => 0)
586
+
587
+ @ncover.filters(
588
+ NCover::DocumentFilter.new(:filter_type => :exclude, :filter => "Foo"),
589
+ NCover::DocumentFilter.new(:filter_type => :include, :filter => "Bar")
590
+ )
591
+
592
+ @ncover.execute
593
+ end
594
+
595
+ it "should exclude the specified data" do
596
+ @ncover.system_command.should include("//cf \"Foo\":Document:false:false")
597
+ end
598
+
599
+ it "should include the specified data" do
600
+ @ncover.system_command.should include("//cf \"Bar\":Document:false:true")
601
+ end
602
+
603
+ it "should not fail" do
604
+ $task_failed.should be_false
605
+ end
606
+ end
607
+
608
+ describe NCoverReport, "when providing configuration values" do
609
+ let :ncoverreport do
610
+ Albacore.configure do |config|
611
+ config.ncoverreport.command = "configured"
612
+ end
613
+ ncoverreport = NCoverReport.new
614
+ end
615
+
616
+ it "should use the configured values" do
617
+ ncoverreport.command.should == "configured"
618
+ end
619
+ end