albacore 0.1.5 → 0.2.0.preview1

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 (136) hide show
  1. data/.autotest +4 -0
  2. data/README.markdown +1 -1
  3. data/VERSION +1 -1
  4. data/install_dependencies.rb +2 -3
  5. data/lib/albacore.rb +1 -0
  6. data/lib/albacore/albacoremodel.rb +28 -0
  7. data/lib/albacore/assemblyinfo.rb +5 -4
  8. data/lib/albacore/config/assemblyinfoconfig.rb +21 -0
  9. data/lib/albacore/config/config.rb +14 -0
  10. data/lib/albacore/config/cscconfig.rb +33 -0
  11. data/lib/albacore/config/docuconfig.rb +25 -0
  12. data/lib/albacore/config/execconfig.rb +22 -0
  13. data/lib/albacore/config/msbuildconfig.rb +32 -0
  14. data/lib/albacore/config/mspecconfig.rb +21 -0
  15. data/lib/albacore/config/nantconfig.rb +22 -0
  16. data/lib/albacore/config/ncoverconsoleconfig.rb +22 -0
  17. data/lib/albacore/config/ncoverreportconfig.rb +22 -0
  18. data/lib/albacore/config/ndependconfig.rb +22 -0
  19. data/lib/albacore/config/netversion.rb +23 -0
  20. data/lib/albacore/config/nunitconfig.rb +20 -0
  21. data/lib/albacore/config/specflowreportconfig.rb +27 -0
  22. data/lib/albacore/config/sqlcmdconfig.rb +22 -0
  23. data/lib/albacore/config/unzipconfig.rb +22 -0
  24. data/lib/albacore/config/xbuildconfig.rb +22 -0
  25. data/lib/albacore/config/xunitconfig.rb +22 -0
  26. data/lib/albacore/config/zipconfig.rb +22 -0
  27. data/lib/albacore/csc.rb +31 -0
  28. data/lib/albacore/docu.rb +8 -6
  29. data/lib/albacore/exec.rb +9 -3
  30. data/lib/albacore/msbuild.rb +5 -12
  31. data/lib/albacore/mspectestrunner.rb +9 -7
  32. data/lib/albacore/nant.rb +5 -4
  33. data/lib/albacore/ncoverconsole.rb +6 -9
  34. data/lib/albacore/ncoverreport.rb +8 -6
  35. data/lib/albacore/ncoverreports/codecoveragebase.rb +4 -4
  36. data/lib/albacore/ncoverreports/cyclomaticcomplexity.rb +4 -4
  37. data/lib/albacore/ncoverreports/fullcoveragereport.rb +3 -3
  38. data/lib/albacore/ncoverreports/reportfilterbase.rb +4 -4
  39. data/lib/albacore/ncoverreports/summaryreport.rb +3 -3
  40. data/lib/albacore/ndepend.rb +12 -9
  41. data/lib/albacore/nunittestrunner.rb +9 -7
  42. data/lib/albacore/specflowreport.rb +62 -0
  43. data/lib/albacore/sqlcmd.rb +8 -6
  44. data/lib/albacore/support/attrmethods.rb +7 -8
  45. data/lib/albacore/support/logging.rb +8 -4
  46. data/lib/albacore/support/openstruct.rb +13 -0
  47. data/lib/albacore/support/runcommand.rb +24 -24
  48. data/lib/albacore/support/supportlinux.rb +23 -0
  49. data/lib/albacore/support/yamlconfig.rb +2 -10
  50. data/lib/albacore/unzip.rb +14 -12
  51. data/lib/albacore/xbuild.rb +6 -5
  52. data/lib/albacore/xunittestrunner.rb +8 -6
  53. data/lib/albacore/zipdirectory.rb +27 -6
  54. data/lib/rake/csctask.rb +3 -0
  55. data/lib/rake/specflowreporttask.rb +3 -0
  56. data/lib/rake/unziptask.rb +1 -1
  57. data/rakefile.rb +21 -54
  58. data/spec/albacoremodel_spec.rb +35 -0
  59. data/spec/assemblyinfo_spec.rb +17 -0
  60. data/spec/attrmethods_spec.rb +17 -1
  61. data/spec/config_spec.rb +19 -0
  62. data/spec/createtask_spec.rb +45 -4
  63. data/spec/csc_spec.rb +87 -0
  64. data/spec/csctask_spec.rb +1 -0
  65. data/spec/docu_spec.rb +43 -1
  66. data/spec/exec_spec.rb +16 -1
  67. data/spec/msbuild_spec.rb +30 -18
  68. data/spec/mspec_spec.rb +28 -0
  69. data/spec/nant_spec.rb +20 -12
  70. data/spec/ncoverconsole_spec.rb +25 -13
  71. data/spec/ncoverreport_spec.rb +31 -18
  72. data/spec/ndepend_spec.rb +23 -2
  73. data/spec/nunittestrunner_spec.rb +48 -0
  74. data/spec/runcommand_spec.rb +59 -32
  75. data/spec/specflowreport_spec.rb +146 -0
  76. data/spec/specflowreporttask_spec.rb +48 -0
  77. data/spec/sqlcmd_spec.rb +18 -5
  78. data/spec/support/SpecFlow/TechTalk.SpecFlow.dll +0 -0
  79. data/spec/support/SpecFlow/TestSolution.SpecFlow.dll +0 -0
  80. data/spec/support/SpecFlow/TestSolution.SpecFlow.pdb +0 -0
  81. data/spec/support/SpecFlow/TestSolution.dll +0 -0
  82. data/spec/support/SpecFlow/TestSolution.pdb +0 -0
  83. data/spec/support/SpecFlow/nunit.framework.dll +0 -0
  84. data/spec/support/TestSolution/TestSolution.5.0.ReSharper.user +27 -0
  85. data/spec/support/TestSolution/TestSolution.SpecFlow/OneFeature.feature +8 -0
  86. data/spec/support/TestSolution/TestSolution.SpecFlow/OneFeature.feature.cs +73 -0
  87. data/spec/support/TestSolution/TestSolution.SpecFlow/Properties/AssemblyInfo.cs +36 -0
  88. data/spec/support/TestSolution/TestSolution.SpecFlow/StepDefinition.cs +30 -0
  89. data/spec/support/TestSolution/TestSolution.SpecFlow/TestSolution.SpecFlow.csproj +84 -0
  90. data/spec/support/TestSolution/TestSolution.sln +6 -0
  91. data/spec/support/csc/File1.cs +9 -0
  92. data/spec/support/csc/File2.cs +9 -0
  93. data/spec/support/csc/output/ignorethis.txt +1 -0
  94. data/spec/support/msbuildtestdata.rb +3 -3
  95. data/spec/support/ncoverreporttestdata.rb +2 -2
  96. data/spec/support/spec_helper.rb +2 -1
  97. data/spec/support/yamlconfig/yaml_autoconfig_test.yml +1 -1
  98. data/spec/unzip_spec.rb +15 -0
  99. data/spec/xbuild_spec.rb +15 -0
  100. data/spec/xunit_spec.rb +16 -2
  101. data/spec/yamlconfig_spec.rb +7 -6
  102. data/spec/zip_spec.rb +50 -9
  103. data/watchrtesting.rb +8 -0
  104. metadata +99 -91
  105. data/lib/albacore/expandtemplates.rb +0 -81
  106. data/lib/albacore/plink.rb +0 -49
  107. data/lib/albacore/renamer.rb +0 -17
  108. data/lib/albacore/sftp.rb +0 -42
  109. data/lib/albacore/ssh.rb +0 -44
  110. data/lib/albacore/support/albacore_helper.rb +0 -1
  111. data/lib/albacore/support/globalconfig.rb +0 -6
  112. data/lib/rake/expandtemplatestask.rb +0 -3
  113. data/lib/rake/plinktask.rb +0 -3
  114. data/lib/rake/renametask.rb +0 -3
  115. data/lib/rake/sftptask.rb +0 -3
  116. data/lib/rake/sshtask.rb +0 -3
  117. data/spec/expandtemplates_spec.rb +0 -180
  118. data/spec/expandtemplatestask_spec.rb +0 -46
  119. data/spec/plink_spec.rb +0 -62
  120. data/spec/plinktask_spec.rb +0 -46
  121. data/spec/renametask_spec.rb +0 -32
  122. data/spec/sftp_spec.rb +0 -30
  123. data/spec/sftptask_spec.rb +0 -42
  124. data/spec/ssh_spec.rb +0 -47
  125. data/spec/sshtask_spec.rb +0 -40
  126. data/spec/support/expandtemplates/datafiles/multiplevalues.yml +0 -3
  127. data/spec/support/expandtemplates/datafiles/multitemplate-specificfile.yml +0 -11
  128. data/spec/support/expandtemplates/datafiles/multitemplate.yml +0 -4
  129. data/spec/support/expandtemplates/datafiles/sample.yml +0 -1
  130. data/spec/support/expandtemplates/datafiles/sample_with_include.yml +0 -2
  131. data/spec/support/expandtemplates/datafiles/template_specific_data_file_with_include.yml +0 -5
  132. data/spec/support/expandtemplates/datafiles/template_specific_include.yml +0 -3
  133. data/spec/support/expandtemplates/templates/multipleinstance.config +0 -4
  134. data/spec/support/expandtemplates/templates/multiplevalues.config +0 -1
  135. data/spec/support/expandtemplates/templates/sample.config +0 -1
  136. data/spec/support/expandtemplatestestdata.rb +0 -77
@@ -22,7 +22,7 @@ describe NCoverReport, "when running a full coverage report with a specified out
22
22
  @ncover.extend(SystemPatch)
23
23
  @ncover.log_level = :verbose
24
24
 
25
- @ncover.path_to_command = NCoverReportTestData.path_to_command
25
+ @ncover.command = NCoverReportTestData.command
26
26
  @ncover.coverage_files NCoverReportTestData.coverage_file
27
27
 
28
28
  fullcoveragereport = NCover::FullCoverageReport.new()
@@ -33,7 +33,7 @@ describe NCoverReport, "when running a full coverage report with a specified out
33
33
  end
34
34
 
35
35
  it "should execute ncover.reporting" do
36
- @ncover.system_command.should include(NCoverReportTestData.path_to_command)
36
+ @ncover.system_command.should include(NCoverReportTestData.command)
37
37
  end
38
38
 
39
39
  it "should tell ncover.reporting to produce a full coverage html report in the specified folder" do
@@ -53,7 +53,7 @@ describe NCoverReport, "when running a summary report with a specified output fo
53
53
  @ncover.extend(SystemPatch)
54
54
  @ncover.log_level = :verbose
55
55
 
56
- @ncover.path_to_command = NCoverReportTestData.path_to_command
56
+ @ncover.command = NCoverReportTestData.command
57
57
  @ncover.coverage_files NCoverReportTestData.coverage_file
58
58
 
59
59
  summaryreport = NCover::SummaryReport.new()
@@ -64,7 +64,7 @@ describe NCoverReport, "when running a summary report with a specified output fo
64
64
  end
65
65
 
66
66
  it "should execute ncover.reporting" do
67
- @ncover.system_command.should include(NCoverReportTestData.path_to_command)
67
+ @ncover.system_command.should include(NCoverReportTestData.command)
68
68
  end
69
69
 
70
70
  it "should tell ncover.reporting to produce a summary html report in the specified folder" do
@@ -84,7 +84,7 @@ describe NCoverReport, "when running multiple ncover reports - a summary and a f
84
84
  @ncover.extend(SystemPatch)
85
85
  @ncover.log_level = :verbose
86
86
 
87
- @ncover.path_to_command = NCoverReportTestData.path_to_command
87
+ @ncover.command = NCoverReportTestData.command
88
88
  @ncover.coverage_files NCoverReportTestData.coverage_file
89
89
 
90
90
  summaryreport = NCover::SummaryReport.new()
@@ -116,7 +116,7 @@ describe NCoverReport, "when running a report with a specified minimum symbol co
116
116
  @ncover.extend(FailPatch)
117
117
  @ncover.log_level = :verbose
118
118
 
119
- @ncover.path_to_command = NCoverReportTestData.path_to_command
119
+ @ncover.command = NCoverReportTestData.command
120
120
  @ncover.coverage_files NCoverReportTestData.coverage_file
121
121
 
122
122
  fullcoveragereport = NCover::FullCoverageReport.new
@@ -152,7 +152,7 @@ describe NCoverReport, "when running a report with a specified minimum symbol co
152
152
  @ncover.extend(FailPatch)
153
153
  @ncover.log_level = :verbose
154
154
 
155
- @ncover.path_to_command = NCoverReportTestData.path_to_command
155
+ @ncover.command = NCoverReportTestData.command
156
156
  @ncover.coverage_files NCoverReportTestData.coverage_file
157
157
 
158
158
  fullcoveragereport = NCover::FullCoverageReport.new
@@ -188,7 +188,7 @@ describe NCoverReport, "when specifying the coverage item type to check" do
188
188
  @ncover.extend(FailPatch)
189
189
  @ncover.log_level = :verbose
190
190
 
191
- @ncover.path_to_command = NCoverReportTestData.path_to_command
191
+ @ncover.command = NCoverReportTestData.command
192
192
  @ncover.coverage_files NCoverReportTestData.coverage_file
193
193
 
194
194
  report = NCover::SummaryReport.new
@@ -221,7 +221,7 @@ describe NCoverReport, "when checking more than one type of coverage and all fai
221
221
  @ncover.extend(FailPatch)
222
222
  @ncover.log_level = :verbose
223
223
 
224
- @ncover.path_to_command = NCoverReportTestData.path_to_command
224
+ @ncover.command = NCoverReportTestData.command
225
225
  @ncover.coverage_files NCoverReportTestData.coverage_file
226
226
 
227
227
  fullcoveragereport = NCover::FullCoverageReport.new
@@ -267,7 +267,7 @@ describe NCoverReport, "when checking more than one type of coverage and all pas
267
267
  @ncover.extend(FailPatch)
268
268
  @ncover.log_level = :verbose
269
269
 
270
- @ncover.path_to_command = NCoverReportTestData.path_to_command
270
+ @ncover.command = NCoverReportTestData.command
271
271
  @ncover.coverage_files NCoverReportTestData.coverage_file
272
272
 
273
273
  fullcoveragereport = NCover::FullCoverageReport.new
@@ -313,7 +313,7 @@ describe NCoverReport, "when checking more than one type of coverage and one fai
313
313
  @ncover.extend(FailPatch)
314
314
  @ncover.log_level = :verbose
315
315
 
316
- @ncover.path_to_command = NCoverReportTestData.path_to_command
316
+ @ncover.command = NCoverReportTestData.command
317
317
  @ncover.coverage_files NCoverReportTestData.coverage_file
318
318
 
319
319
  fullcoveragereport = NCover::FullCoverageReport.new
@@ -354,7 +354,7 @@ describe NCoverReport, "when running a report with a cyclomatic complexity highe
354
354
  @ncover.extend(FailPatch)
355
355
  @ncover.log_level = :verbose
356
356
 
357
- @ncover.path_to_command = NCoverReportTestData.path_to_command
357
+ @ncover.command = NCoverReportTestData.command
358
358
  @ncover.coverage_files NCoverReportTestData.coverage_file
359
359
 
360
360
  fullcoveragereport = NCover::FullCoverageReport.new
@@ -389,7 +389,7 @@ describe NCoverReport, "when running a report with a cyclomatic complexity under
389
389
  @ncover.extend(FailPatch)
390
390
  @ncover.log_level = :verbose
391
391
 
392
- @ncover.path_to_command = NCoverReportTestData.path_to_command
392
+ @ncover.command = NCoverReportTestData.command
393
393
  @ncover.coverage_files NCoverReportTestData.coverage_file
394
394
 
395
395
  fullcoveragereport = NCover::FullCoverageReport.new
@@ -424,7 +424,7 @@ describe NCoverReport, "when filtering on Assembly coverage data" do
424
424
  @ncover.extend(FailPatch)
425
425
  @ncover.log_level = :verbose
426
426
 
427
- @ncover.path_to_command = NCoverReportTestData.path_to_command
427
+ @ncover.command = NCoverReportTestData.command
428
428
  @ncover.coverage_files NCoverReportTestData.coverage_file
429
429
 
430
430
  fullcoveragereport = NCover::FullCoverageReport.new
@@ -462,7 +462,7 @@ describe NCoverReport, "when filtering on Namespace coverage data" do
462
462
  @ncover.extend(FailPatch)
463
463
  @ncover.log_level = :verbose
464
464
 
465
- @ncover.path_to_command = NCoverReportTestData.path_to_command
465
+ @ncover.command = NCoverReportTestData.command
466
466
  @ncover.coverage_files NCoverReportTestData.coverage_file
467
467
 
468
468
  fullcoveragereport = NCover::FullCoverageReport.new
@@ -500,7 +500,7 @@ describe NCoverReport, "when filtering on Class coverage data" do
500
500
  @ncover.extend(FailPatch)
501
501
  @ncover.log_level = :verbose
502
502
 
503
- @ncover.path_to_command = NCoverReportTestData.path_to_command
503
+ @ncover.command = NCoverReportTestData.command
504
504
  @ncover.coverage_files NCoverReportTestData.coverage_file
505
505
 
506
506
  fullcoveragereport = NCover::FullCoverageReport.new
@@ -538,7 +538,7 @@ describe NCoverReport, "when filtering on Method coverage data" do
538
538
  @ncover.extend(FailPatch)
539
539
  @ncover.log_level = :verbose
540
540
 
541
- @ncover.path_to_command = NCoverReportTestData.path_to_command
541
+ @ncover.command = NCoverReportTestData.command
542
542
  @ncover.coverage_files NCoverReportTestData.coverage_file
543
543
 
544
544
  fullcoveragereport = NCover::FullCoverageReport.new
@@ -576,7 +576,7 @@ describe NCoverReport, "when filtering on Document coverage data" do
576
576
  @ncover.extend(FailPatch)
577
577
  @ncover.log_level = :verbose
578
578
 
579
- @ncover.path_to_command = NCoverReportTestData.path_to_command
579
+ @ncover.command = NCoverReportTestData.command
580
580
  @ncover.coverage_files NCoverReportTestData.coverage_file
581
581
 
582
582
  fullcoveragereport = NCover::FullCoverageReport.new
@@ -604,3 +604,16 @@ describe NCoverReport, "when filtering on Document coverage data" do
604
604
  $task_failed.should be_false
605
605
  end
606
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
data/spec/ndepend_spec.rb CHANGED
@@ -14,7 +14,7 @@ describe "when executing Ndepend console" do
14
14
  @ndepend = NDepend.new
15
15
  @ndepend.log_device = StringIO.new
16
16
  @ndepend.project_file = "spec/support/TestSolution/NDependProject.xml"
17
- @ndepend.path_to_command = "spec/support/tools/Ndepend-v2.12/NDepend.Console.exe"
17
+ @ndepend.command = "spec/support/tools/Ndepend-v2.12/NDepend.Console.exe"
18
18
 
19
19
  @logger = StringIO.new
20
20
  @ndepend.log_device = @logger
@@ -48,4 +48,25 @@ describe "when executing Ndepend console" do
48
48
  @ndepend.run
49
49
  @log_data.should include(expected_params)
50
50
  end
51
- end
51
+
52
+ it "should order command line properly by including ndepend project file first" do
53
+ expected_params = "/Help"
54
+ @ndepend.parameters expected_params
55
+ @ndepend.extend(FailPatch)
56
+ @ndepend.run
57
+ @log_data.should =~ /.*NDepend.Console.exe.*NDependProject.xml.*Help.*/
58
+ end
59
+ end
60
+
61
+ describe NDepend, "when providing configuration" do
62
+ let :ndepend do
63
+ Albacore.configure do |config|
64
+ config.ndepend.command = "configured"
65
+ end
66
+ ndepend = NDepend.new
67
+ end
68
+
69
+ it "should use the configured values" do
70
+ ndepend.command.should == "configured"
71
+ end
72
+ end
@@ -72,3 +72,51 @@ describe NUnitTestRunner, "when configured correctly" do
72
72
  $task_failed.should be_false
73
73
  end
74
74
  end
75
+
76
+ describe NUnitTestRunner, "when using the configuration command and not providing a command in the intializer" do
77
+ it_should_behave_like "nunit paths"
78
+
79
+ before :all do
80
+ Albacore.configure do |config|
81
+ config.nunit.command = "configured command"
82
+ end
83
+ @nunit = NUnitTestRunner.new
84
+ end
85
+
86
+ it "should use the configuration command" do
87
+ @nunit.command.should == "configured command"
88
+ end
89
+ end
90
+
91
+ describe NUnitTestRunner, "when the command has been set through configuration and providing a command in the intializer" do
92
+ it_should_behave_like "nunit paths"
93
+
94
+ before :all do
95
+ Albacore.configure do |config|
96
+ config.nunit.command = "configured command"
97
+ end
98
+ @nunit = NUnitTestRunner.new("initializer command")
99
+ end
100
+
101
+ it "should use the initializer command" do
102
+ @nunit.command.should == "initializer command"
103
+ end
104
+ end
105
+
106
+ describe NUnitTestRunner, "when configuration has been provided" do
107
+ before :all do
108
+ Albacore.configure do |config|
109
+ config.nunit do |nunit|
110
+ nunit.assemblies = ["foo.dll", "bar.dll"]
111
+ nunit.options = ["/noshadow"]
112
+ end
113
+ end
114
+
115
+ @nunit = NUnitTestRunner.new
116
+ end
117
+
118
+ it "should use the provided configuration" do
119
+ @nunit.assemblies.should == ["foo.dll", "bar.dll"]
120
+ @nunit.options.should == ["/noshadow"]
121
+ end
122
+ end
@@ -1,48 +1,75 @@
1
1
  require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
2
- require 'albacore/support/albacore_helper'
2
+ require 'albacore/albacoremodel'
3
3
  require 'system_patch'
4
4
 
5
5
  class RunCommandObject
6
- include YAMLConfig
6
+ include AlbacoreModel
7
7
  include RunCommand
8
8
 
9
9
  def execute
10
- @require_valid_command = false
11
10
  result = run_command "Run Command Test Object"
12
11
  end
13
12
  end
14
13
 
15
- describe "when running two instances of a command line task" do
14
+ describe "when setting the command" do
16
15
  before :all do
17
- create_task :run_command_task, Proc.new { RunCommandObject.new } do |ex|
18
- ex.execute
19
- end
20
-
21
- run_command_task :one do |x|
22
- x.extend(SystemPatch)
23
- x.path_to_command = "set"
24
- x.parameters "_albacore_test = test_one"
25
- @one = x
26
- end
27
-
28
- run_command_task :two do |x|
29
- x.extend(SystemPatch)
30
- x.path_to_command = "set"
31
- x.parameters "_another_albacore_test = test_two"
32
- @two = x
33
- end
34
-
35
- Rake::Task[:one].invoke
36
- Rake::Task[:two].invoke
37
- end
38
-
39
- it "should only pass the parameters specified to the first command" do
40
- @one.system_command.should == "\"set\" _albacore_test = test_one"
41
- end
42
-
43
- it "should only pass the parameters specified to the second command" do
44
- @two.system_command.should == "\"set\" _another_albacore_test = test_two"
16
+ @runme = RunCommandObject.new
17
+ @runme.extend SystemPatch
18
+
19
+ @runme.command = "test.exe"
20
+ @runme.execute
21
+ end
22
+
23
+ it "should execute the specified command, quoted" do
24
+ @runme.system_command.should == "\"test.exe\""
25
+ end
26
+ end
27
+
28
+ describe "when specifying a parmaeter to a command" do
29
+ before :all do
30
+ @runme = RunCommandObject.new
31
+ @runme.extend SystemPatch
32
+ @runme.command = "test.exe"
33
+ @runme.parameters "param1"
34
+ @runme.execute
35
+ end
36
+
37
+ it "should separate the parameters from the command" do
38
+ @runme.system_command.should == "\"test.exe\" param1"
39
+ end
40
+ end
41
+
42
+ describe "when specifying multiple parameters to a command" do
43
+ before :all do
44
+ @runme = RunCommandObject.new
45
+ @runme.extend SystemPatch
46
+ @runme.command = "test.exe"
47
+ @runme.parameters "param1", "param2", "param3"
48
+ @runme.execute
49
+ end
50
+
51
+ it "should separate all parameters by a space" do
52
+ @runme.system_command.should == "\"test.exe\" param1 param2 param3"
45
53
  end
46
54
  end
47
55
 
56
+ describe "when executing a runcommand object twice" do
57
+ before :all do
58
+ @runmeone = RunCommandObject.new
59
+ @runmetwo = @runmeone
60
+ @runmeone.extend SystemPatch
61
+ @runmeone.command = "test.exe"
62
+ @runmeone.parameters "1", "2", "3"
48
63
 
64
+ @runmeone.execute
65
+ @runmetwo.execute
66
+ end
67
+
68
+ it "should only pass the parameters to the command once for the first execution" do
69
+ @runmeone.system_command.should == "\"test.exe\" 1 2 3"
70
+ end
71
+
72
+ it "should only pass the parameters to the command once for the second execution" do
73
+ @runmetwo.system_command.should == "\"test.exe\" 1 2 3"
74
+ end
75
+ end
@@ -0,0 +1,146 @@
1
+ require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
2
+ require 'albacore/specflowreport'
3
+ require 'albacore/nunittestrunner'
4
+
5
+ shared_examples_for "specflow paths" do
6
+ before :all do
7
+ @specflowpath = File.join(File.dirname(__FILE__), 'support', 'Tools', 'SpecFlow', 'specflow.exe')
8
+ @test_project = File.join(File.expand_path(File.dirname(__FILE__)), 'support', 'TestSolution', 'TestSolution.SpecFlow', 'TestSolution.SpecFlow.csproj')
9
+ @nunit_test_restuls = "/xmlTestResult:TestResult.xml"
10
+ @output_option = "/out:specs.html"
11
+ end
12
+ end
13
+
14
+ describe SpecFlowReport, "when running without specifying command path" do
15
+ it_should_behave_like "specflow paths"
16
+
17
+ before :all do
18
+ @spec = SpecFlowReport.new()
19
+ @spec.projects @test_project
20
+ end
21
+
22
+ it "should try to run in same folder" do
23
+ @spec.command.should eql('specflow.exe')
24
+ end
25
+ end
26
+
27
+ describe SpecFlowReport, "When not passing a project" do
28
+
29
+ before :all do
30
+ @spec = SpecFlowReport.new()
31
+ @spec.extend(FailPatch)
32
+ @spec.execute
33
+ $task_failed.should be_true
34
+ end
35
+
36
+ it "should fail" do
37
+ $task_failed.should be_true
38
+ end
39
+ end
40
+
41
+ describe SpecFlowReport, "When passing a command" do
42
+ it_should_behave_like "specflow paths"
43
+
44
+ before :all do
45
+ @spec = SpecFlowReport.new("/path_to_command/")
46
+ @spec.projects @test_project
47
+ end
48
+
49
+ it "should not include specflow.exe" do
50
+ @spec.command.should eql('/path_to_command/')
51
+ end
52
+ end
53
+
54
+ describe SpecFlowReport, "When passing some options" do
55
+ it_should_behave_like "specflow paths"
56
+ before :all do
57
+ spec = SpecFlowReport.new()
58
+ spec.options @output_option
59
+ spec.projects @test_project
60
+ @command_line = spec.get_command_line
61
+ end
62
+
63
+ it "should include the options in the command line" do
64
+ @command_line.should include(@output_option)
65
+ end
66
+ end
67
+
68
+ describe SpecFlowReport, "When no options are passed" do
69
+ it_should_behave_like "specflow paths"
70
+
71
+ before :all do
72
+ spec = SpecFlowReport.new()
73
+ spec.projects @test_project
74
+ @command_line = spec.get_command_line
75
+ end
76
+
77
+ it "should include sensible defaults" do
78
+ @command_line.should include("/xmlTestResult:TestResult.xml /out:specs.html")
79
+ end
80
+ end
81
+
82
+ describe SpecFlowReport, "When a report is specified" do
83
+ it_should_behave_like "specflow paths"
84
+ before :all do
85
+ @spec = SpecFlowReport.new()
86
+ @spec.report = 'assigned report'
87
+ @spec.projects @test_project
88
+ end
89
+
90
+ it "should include the specified report in the command line" do
91
+ @spec.get_command_line.should include("assigned report")
92
+ end
93
+ end
94
+
95
+ describe SpecFlowReport, "When no report is specified" do
96
+ it_should_behave_like "specflow paths"
97
+ before :all do
98
+ @spec = SpecFlowReport.new()
99
+ @spec.projects @test_project
100
+ end
101
+
102
+ it "should include the nunit report in the command line" do
103
+ @spec.get_command_line.should include("nunitexecutionreport")
104
+ end
105
+ end
106
+
107
+ describe SpecFlowReport, "when configured correctly" do
108
+ it_should_behave_like "specflow paths"
109
+
110
+ before :all do
111
+ nunitpath = File.join(File.dirname(__FILE__), 'support', 'Tools', 'NUnit-v2.5', 'nunit-console-x86.exe')
112
+ test_assembly = File.join(File.expand_path(File.dirname(__FILE__)), 'support', 'SpecFlow', 'TestSolution.SpecFlow.dll')
113
+
114
+ nunit = NUnitTestRunner.new(nunitpath)
115
+ nunit.extend(FailPatch)
116
+ nunit.assemblies test_assembly
117
+ nunit.options '/noshadow /out=TestResult.xml'
118
+ nunit.execute
119
+
120
+ spec = SpecFlowReport.new(@specflowpath)
121
+ spec.extend(FailPatch)
122
+ spec.projects @test_project
123
+
124
+ spec.execute
125
+ end
126
+
127
+ it "should execute" do
128
+ $task_failed.should be_false
129
+ end
130
+ end
131
+
132
+ describe SpecFlowReport, "when providing configuration" do
133
+ let :specflow do
134
+ Albacore.configure do |config|
135
+ config.specflowreport.command = "configured"
136
+ config.specflowreport.report = "configured report"
137
+ end
138
+ specflow = SpecFlowReport.new
139
+ end
140
+
141
+ it "should use the configured values" do
142
+ specflow.command.should == "configured"
143
+ specflow.report.should == "configured report"
144
+ end
145
+ end
146
+