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,13 +1,13 @@
1
- class Docu
2
- attr_accessor :command_result, :command_parameters, :failed, :failure_message
3
-
4
- def run_command(command_name="Command Line", command_parameters="")
5
- @command_parameters = command_parameters
6
- @command_result || false
7
- end
8
-
9
- def fail_with_message(msg)
10
- @failed = true
11
- @failure_message = msg
12
- end
1
+ class Docu
2
+ attr_accessor :command_result, :command_parameters, :failed, :failure_message
3
+
4
+ def run_command(command_name="Command Line", command_parameters="")
5
+ @command_parameters = command_parameters
6
+ @command_result || false
7
+ end
8
+
9
+ def fail_with_message(msg)
10
+ @failed = true
11
+ @failure_message = msg
12
+ end
13
13
  end
@@ -1,9 +1,9 @@
1
- module FailPatch
2
- def self.extended(obj)
3
- $task_failed = false
4
- end
5
-
6
- def fail(*args)
7
- $task_failed = true
8
- end
1
+ module FailPatch
2
+ def self.extended(obj)
3
+ $task_failed = false
4
+ end
5
+
6
+ def fail(*args)
7
+ $task_failed = true
8
+ end
9
9
  end
@@ -1,20 +1,20 @@
1
- module SystemPatch
2
- attr_accessor :disable_system, :force_system_failure
3
-
4
- def initialize
5
- @disable_system = false
6
- @force_command_failure = false
7
- end
8
-
9
- def system_command
10
- @system_command
11
- end
12
-
13
- def system(cmd)
14
- @system_command = cmd
15
- result = true
16
- result = super(cmd) if !disable_system
17
- return false if @force_system_failure
18
- return result
19
- end
20
- end
1
+ module SystemPatch
2
+ attr_accessor :disable_system, :force_system_failure
3
+
4
+ def initialize
5
+ @disable_system = false
6
+ @force_command_failure = false
7
+ end
8
+
9
+ def system_command
10
+ @system_command
11
+ end
12
+
13
+ def system(cmd)
14
+ @system_command = cmd
15
+ result = true
16
+ result = super(cmd) if !disable_system
17
+ return false if @force_system_failure
18
+ return result
19
+ end
20
+ end
@@ -1,62 +1,62 @@
1
- require 'spec_helper'
2
- require 'albacore/plink'
3
-
4
- describe PLink, 'when executing a command over plink' do
5
- before :each do
6
- @cmd = PLink.new
7
- @cmd.extend(SystemPatch)
8
- @cmd.extend(FailPatch)
9
- @cmd.command ="C:\\plink.exe"
10
- @cmd.host = "testhost"
11
-
12
- end
13
-
14
- it "should attempt to execute plink.exe" do
15
- @cmd.run
16
- @cmd.system_command.should include("plink.exe")
17
- end
18
-
19
- it "should attempt to connect to the test host on the default port (22)" do
20
- @cmd.run
21
- @cmd.system_command.should include("@testhost")
22
- @cmd.system_command.should include("-P 22")
23
- end
24
-
25
- it "should connect to the test host on a non default port 2200" do
26
- @cmd.port = 2200
27
- @cmd.run
28
- @cmd.system_command.should include("-P 2200")
29
- end
30
-
31
- it "should connect to the host with a username" do
32
- expected_user = "dummyuser"
33
- @cmd.user = expected_user
34
- @cmd.run
35
- @cmd.system_command.should include("#{expected_user}@")
36
- end
37
-
38
- it "should run remote commands in batch mode" do
39
- @cmd.run
40
- @cmd.system_command.should include("-batch")
41
- end
42
-
43
- it "should run commands in verbose mode" do
44
- @cmd.verbose = true
45
- @cmd.run
46
- @cmd.system_command.should include("-v")
47
- end
48
-
49
- it "should include the remote command" do
50
- expected_remote_exe = "C:\ThisIsTheRemoteExe.exe"
51
- @cmd.commands expected_remote_exe
52
- @cmd.run
53
- @cmd.system_command.should include(expected_remote_exe)
54
- end
55
-
56
- it "should include the remote command with parameters" do
57
- expected_remote_exe = "C:\\ThisIsTheRemoteExe.exe --help -o -p"
58
- @cmd.commands expected_remote_exe
59
- @cmd.run
60
- @cmd.system_command.should include(expected_remote_exe)
61
- end
62
- end
1
+ require 'spec_helper'
2
+ require 'albacore/plink'
3
+
4
+ describe PLink, 'when executing a command over plink' do
5
+ before :each do
6
+ @cmd = PLink.new
7
+ @cmd.extend(SystemPatch)
8
+ @cmd.extend(FailPatch)
9
+ @cmd.command ="C:\\plink.exe"
10
+ @cmd.host = "testhost"
11
+
12
+ end
13
+
14
+ it "should attempt to execute plink.exe" do
15
+ @cmd.run
16
+ @cmd.system_command.should include("plink.exe")
17
+ end
18
+
19
+ it "should attempt to connect to the test host on the default port (22)" do
20
+ @cmd.run
21
+ @cmd.system_command.should include("@testhost")
22
+ @cmd.system_command.should include("-P 22")
23
+ end
24
+
25
+ it "should connect to the test host on a non default port 2200" do
26
+ @cmd.port = 2200
27
+ @cmd.run
28
+ @cmd.system_command.should include("-P 2200")
29
+ end
30
+
31
+ it "should connect to the host with a username" do
32
+ expected_user = "dummyuser"
33
+ @cmd.user = expected_user
34
+ @cmd.run
35
+ @cmd.system_command.should include("#{expected_user}@")
36
+ end
37
+
38
+ it "should run remote commands in batch mode" do
39
+ @cmd.run
40
+ @cmd.system_command.should include("-batch")
41
+ end
42
+
43
+ it "should run commands in verbose mode" do
44
+ @cmd.verbose = true
45
+ @cmd.run
46
+ @cmd.system_command.should include("-v")
47
+ end
48
+
49
+ it "should include the remote command" do
50
+ expected_remote_exe = "C:\ThisIsTheRemoteExe.exe"
51
+ @cmd.commands expected_remote_exe
52
+ @cmd.run
53
+ @cmd.system_command.should include(expected_remote_exe)
54
+ end
55
+
56
+ it "should include the remote command with parameters" do
57
+ expected_remote_exe = "C:\\ThisIsTheRemoteExe.exe --help -o -p"
58
+ @cmd.commands expected_remote_exe
59
+ @cmd.run
60
+ @cmd.system_command.should include(expected_remote_exe)
61
+ end
62
+ end
@@ -1,94 +1,94 @@
1
- require 'spec_helper'
2
- require 'albacore/albacoretask'
3
- require 'system_patch'
4
-
5
- class RunCommandObject
6
- include Albacore::Task
7
- include Albacore::RunCommand
8
-
9
- def execute
10
- result = run_command "Run Command Test Object"
11
- end
12
- end
13
-
14
- describe "when setting the command" do
15
- before :all do
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 parameter 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"
53
- end
54
- end
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"
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
76
-
77
- describe "when the command exists relative to the project root" do
78
- before :all do
79
- @runme = RunCommandObject.new
80
- @runme.extend SystemPatch
81
-
82
- File.open('test.exe', 'w') {}
83
- @runme.command = "test.exe"
84
- @runme.execute
85
- end
86
-
87
- after :all do
88
- FileUtils.rm_f('test.exe')
89
- end
90
-
91
- it "should expand the path" do
92
- @runme.system_command.should == "\"#{File.expand_path('test.exe')}\""
93
- end
94
- end
1
+ require 'spec_helper'
2
+ require 'albacore/albacoretask'
3
+ require 'system_patch'
4
+
5
+ class RunCommandObject
6
+ include Albacore::Task
7
+ include Albacore::RunCommand
8
+
9
+ def execute
10
+ result = run_command "Run Command Test Object"
11
+ end
12
+ end
13
+
14
+ describe "when setting the command" do
15
+ before :all do
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 parameter 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"
53
+ end
54
+ end
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"
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
76
+
77
+ describe "when the command exists relative to the project root" do
78
+ before :all do
79
+ @runme = RunCommandObject.new
80
+ @runme.extend SystemPatch
81
+
82
+ File.open('test.exe', 'w') {}
83
+ @runme.command = "test.exe"
84
+ @runme.execute
85
+ end
86
+
87
+ after :all do
88
+ FileUtils.rm_f('test.exe')
89
+ end
90
+
91
+ it "should expand the path" do
92
+ @runme.system_command.should == "\"#{File.expand_path('test.exe')}\""
93
+ end
94
+ end
@@ -1,17 +1,17 @@
1
- @root_dir = File.expand_path(File.join(File.dirname(__FILE__), "../"))
2
-
3
- $: << './'
4
- $: << File.join(@root_dir, "lib")
5
- $: << File.join(@root_dir, "spec")
6
- $: << File.join(@root_dir, "spec/patches")
7
- $: << File.join(@root_dir, "spec/support")
8
- $: << File.join(@root_dir, "lib/albacore/config")
9
-
10
- require 'rubygems'
11
- require 'spec'
12
- require 'rake/tasklib'
13
- require 'lib/albacore/support/createtask.rb'
14
- require 'lib/albacore/config/config.rb'
15
- require 'lib/albacore'
16
- require 'system_patch'
17
- require 'fail_patch'
1
+ @root_dir = File.expand_path(File.join(File.dirname(__FILE__), "../"))
2
+
3
+ $: << './'
4
+ $: << File.join(@root_dir, "lib")
5
+ $: << File.join(@root_dir, "spec")
6
+ $: << File.join(@root_dir, "spec/patches")
7
+ $: << File.join(@root_dir, "spec/support")
8
+ $: << File.join(@root_dir, "lib/albacore/config")
9
+
10
+ require 'rubygems'
11
+ require 'spec'
12
+ require 'rake/tasklib'
13
+ require 'lib/albacore/support/createtask.rb'
14
+ require 'lib/albacore/config/config.rb'
15
+ require 'lib/albacore'
16
+ require 'system_patch'
17
+ require 'fail_patch'
@@ -1,146 +1,146 @@
1
- require '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
-
1
+ require '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
+