albacore 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. data/EULA.txt +19 -0
  2. data/README.markdown +70 -0
  3. data/VERSION +1 -0
  4. data/lib/albacore.rb +9 -0
  5. data/lib/albacore/assemblyinfo.rb +104 -0
  6. data/lib/albacore/expandtemplates.rb +64 -0
  7. data/lib/albacore/msbuild.rb +63 -0
  8. data/lib/albacore/mspectestrunner.rb +33 -0
  9. data/lib/albacore/ncoverconsole.rb +64 -0
  10. data/lib/albacore/ncoverreport.rb +61 -0
  11. data/lib/albacore/ncoverreports/assemblyfilter.rb +10 -0
  12. data/lib/albacore/ncoverreports/branchcoverage.rb +10 -0
  13. data/lib/albacore/ncoverreports/classfilter.rb +9 -0
  14. data/lib/albacore/ncoverreports/codecoveragebase.rb +25 -0
  15. data/lib/albacore/ncoverreports/cyclomaticcomplexity.rb +23 -0
  16. data/lib/albacore/ncoverreports/documentfilter.rb +9 -0
  17. data/lib/albacore/ncoverreports/fullcoveragereport.rb +21 -0
  18. data/lib/albacore/ncoverreports/methodcoverage.rb +10 -0
  19. data/lib/albacore/ncoverreports/methodfilter.rb +9 -0
  20. data/lib/albacore/ncoverreports/namespacefilter.rb +9 -0
  21. data/lib/albacore/ncoverreports/reportfilterbase.rb +26 -0
  22. data/lib/albacore/ncoverreports/summaryreport.rb +22 -0
  23. data/lib/albacore/ncoverreports/symbolcoverage.rb +10 -0
  24. data/lib/albacore/nunittestrunner.rb +38 -0
  25. data/lib/albacore/sftp.rb +24 -0
  26. data/lib/albacore/sqlcmd.rb +55 -0
  27. data/lib/albacore/ssh.rb +25 -0
  28. data/lib/albacore/support/albacore_helper.rb +4 -0
  29. data/lib/albacore/support/failure.rb +22 -0
  30. data/lib/albacore/support/logging.rb +32 -0
  31. data/lib/albacore/support/runcommand.rb +45 -0
  32. data/lib/albacore/support/yamlconfig.rb +30 -0
  33. data/lib/albacore/zipdirectory.rb +55 -0
  34. data/lib/rake/assemblyinfotask.rb +22 -0
  35. data/lib/rake/expandtemplatestask.rb +21 -0
  36. data/lib/rake/msbuildtask.rb +22 -0
  37. data/lib/rake/ncoverconsoletask.rb +22 -0
  38. data/lib/rake/ncoverreporttask.rb +22 -0
  39. data/lib/rake/nunittask.rb +22 -0
  40. data/lib/rake/renametask.rb +25 -0
  41. data/lib/rake/sftptask.rb +21 -0
  42. data/lib/rake/sqlcmdtask.rb +22 -0
  43. data/lib/rake/sshtask.rb +21 -0
  44. data/lib/rake/ziptask.rb +21 -0
  45. data/rakefile.rb +144 -0
  46. data/spec/assemblyinfo_spec.rb +246 -0
  47. data/spec/assemblyinfotask_spec.rb +31 -0
  48. data/spec/expandtemplates_spec.rb +127 -0
  49. data/spec/expandtemplatestask_spec.rb +31 -0
  50. data/spec/msbuild_spec.rb +173 -0
  51. data/spec/msbuildtask_spec.rb +31 -0
  52. data/spec/ncoverconsole_spec.rb +247 -0
  53. data/spec/ncoverconsoletask_spec.rb +31 -0
  54. data/spec/ncoverreport_spec.rb +577 -0
  55. data/spec/ncoverreporttask_spec.rb +31 -0
  56. data/spec/nunittask_spec.rb +31 -0
  57. data/spec/patches/system_patch.rb +16 -0
  58. data/spec/patches/tasklib_patch.rb +12 -0
  59. data/spec/renametask_spec.rb +30 -0
  60. data/spec/sftp_spec.rb +30 -0
  61. data/spec/sftptask_spec.rb +41 -0
  62. data/spec/sqlcmd_spec.rb +139 -0
  63. data/spec/sqlcmdtask_spec.rb +31 -0
  64. data/spec/ssh_spec.rb +48 -0
  65. data/spec/sshtask_spec.rb +39 -0
  66. data/spec/support/AssemblyInfo/assemblyinfo.yml +2 -0
  67. data/spec/support/CodeCoverage/mspec/assemblies/Machine.Specifications.NUnit.dll +0 -0
  68. data/spec/support/CodeCoverage/mspec/assemblies/Machine.Specifications.dll +0 -0
  69. data/spec/support/CodeCoverage/mspec/assemblies/TestSolution.MSpecTests.dll +0 -0
  70. data/spec/support/CodeCoverage/mspec/assemblies/TestSolution.dll +0 -0
  71. data/spec/support/CodeCoverage/mspec/assemblies/nunit.framework.dll +0 -0
  72. data/spec/support/CodeCoverage/nunit/assemblies/TestSolution.Tests.dll +0 -0
  73. data/spec/support/CodeCoverage/nunit/assemblies/TestSolution.dll +0 -0
  74. data/spec/support/CodeCoverage/nunit/assemblies/nunit.framework.dll +0 -0
  75. data/spec/support/CodeCoverage/nunit/failing_assemblies/TestSolution.FailingTests.dll +0 -0
  76. data/spec/support/CodeCoverage/nunit/failing_assemblies/nunit.framework.dll +0 -0
  77. data/spec/support/CodeCoverage/report/coverage.xml +4578 -0
  78. data/spec/support/TestSolution/TestSolution.FailingTests/FailingTestFixture.cs +19 -0
  79. data/spec/support/TestSolution/TestSolution.FailingTests/Properties/AssemblyInfo.cs +36 -0
  80. data/spec/support/TestSolution/TestSolution.FailingTests/TestSolution.FailingTests.csproj +63 -0
  81. data/spec/support/TestSolution/TestSolution.MSpecTests/Properties/AssemblyInfo.cs +36 -0
  82. data/spec/support/TestSolution/TestSolution.MSpecTests/SomeSpecTest.cs +18 -0
  83. data/spec/support/TestSolution/TestSolution.MSpecTests/TestSolution.MSpecTests.csproj +77 -0
  84. data/spec/support/TestSolution/TestSolution.Tests/Properties/AssemblyInfo.cs +36 -0
  85. data/spec/support/TestSolution/TestSolution.Tests/SomeTestFixture.cs +23 -0
  86. data/spec/support/TestSolution/TestSolution.Tests/TestSolution.Tests.csproj +69 -0
  87. data/spec/support/TestSolution/TestSolution.sln +38 -0
  88. data/spec/support/TestSolution/TestSolution/Class1.cs +17 -0
  89. data/spec/support/TestSolution/TestSolution/Properties/AssemblyInfo.cs +36 -0
  90. data/spec/support/TestSolution/TestSolution/TestSolution.csproj +59 -0
  91. data/spec/support/assemblyinfotester.rb +42 -0
  92. data/spec/support/expandtemplates/datafiles/multiplevalues.yml +3 -0
  93. data/spec/support/expandtemplates/datafiles/multitemplate-specificfile.yml +11 -0
  94. data/spec/support/expandtemplates/datafiles/multitemplate.yml +4 -0
  95. data/spec/support/expandtemplates/datafiles/sample.yml +1 -0
  96. data/spec/support/expandtemplates/templates/multipleinstance.config +4 -0
  97. data/spec/support/expandtemplates/templates/multiplevalues.config +1 -0
  98. data/spec/support/expandtemplates/templates/sample.config +1 -0
  99. data/spec/support/expandtemplatestestdata.rb +69 -0
  100. data/spec/support/msbuildtestdata.rb +32 -0
  101. data/spec/support/ncoverreporttestdata.rb +26 -0
  102. data/spec/support/spec_helper.rb +15 -0
  103. data/spec/support/test.yml +4 -0
  104. data/spec/support/zip/files/subfolder/sub file.txt +1 -0
  105. data/spec/support/zip/files/testfile.txt +1 -0
  106. data/spec/support/ziptestdata.rb +8 -0
  107. data/spec/yamlconfig_spec.rb +62 -0
  108. data/spec/zip_spec.rb +18 -0
  109. data/spec/ziptask_spec.rb +31 -0
  110. data/yaml_autoconfig_test.yml +1 -0
  111. metadata +262 -0
@@ -0,0 +1,36 @@
1
+ using System.Reflection;
2
+ using System.Runtime.CompilerServices;
3
+ using System.Runtime.InteropServices;
4
+
5
+ // General Information about an assembly is controlled through the following
6
+ // set of attributes. Change these attribute values to modify the information
7
+ // associated with an assembly.
8
+ [assembly: AssemblyTitle("TestSolution")]
9
+ [assembly: AssemblyDescription("")]
10
+ [assembly: AssemblyConfiguration("")]
11
+ [assembly: AssemblyCompany("")]
12
+ [assembly: AssemblyProduct("TestSolution")]
13
+ [assembly: AssemblyCopyright("Copyright © 2009")]
14
+ [assembly: AssemblyTrademark("")]
15
+ [assembly: AssemblyCulture("")]
16
+
17
+ // Setting ComVisible to false makes the types in this assembly not visible
18
+ // to COM components. If you need to access a type in this assembly from
19
+ // COM, set the ComVisible attribute to true on that type.
20
+ [assembly: ComVisible(false)]
21
+
22
+ // The following GUID is for the ID of the typelib if this project is exposed to COM
23
+ [assembly: Guid("dbabb27c-a536-4b5b-91f1-2226b6e3655c")]
24
+
25
+ // Version information for an assembly consists of the following four values:
26
+ //
27
+ // Major Version
28
+ // Minor Version
29
+ // Build Number
30
+ // Revision
31
+ //
32
+ // You can specify all the values or you can default the Build and Revision Numbers
33
+ // by using the '*' as shown below:
34
+ // [assembly: AssemblyVersion("1.0.*")]
35
+ [assembly: AssemblyVersion("1.0.0.0")]
36
+ [assembly: AssemblyFileVersion("1.0.0.0")]
@@ -0,0 +1,59 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+ <PropertyGroup>
4
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6
+ <ProductVersion>9.0.30729</ProductVersion>
7
+ <SchemaVersion>2.0</SchemaVersion>
8
+ <ProjectGuid>{36F8C06F-3BBA-4D11-9333-83573A760284}</ProjectGuid>
9
+ <OutputType>Library</OutputType>
10
+ <AppDesignerFolder>Properties</AppDesignerFolder>
11
+ <RootNamespace>TestSolution</RootNamespace>
12
+ <AssemblyName>TestSolution</AssemblyName>
13
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
14
+ <FileAlignment>512</FileAlignment>
15
+ </PropertyGroup>
16
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17
+ <DebugSymbols>true</DebugSymbols>
18
+ <DebugType>full</DebugType>
19
+ <Optimize>false</Optimize>
20
+ <OutputPath>bin\Debug\</OutputPath>
21
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
22
+ <ErrorReport>prompt</ErrorReport>
23
+ <WarningLevel>4</WarningLevel>
24
+ </PropertyGroup>
25
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26
+ <DebugType>pdbonly</DebugType>
27
+ <Optimize>true</Optimize>
28
+ <OutputPath>bin\Release\</OutputPath>
29
+ <DefineConstants>TRACE</DefineConstants>
30
+ <ErrorReport>prompt</ErrorReport>
31
+ <WarningLevel>4</WarningLevel>
32
+ </PropertyGroup>
33
+ <ItemGroup>
34
+ <Reference Include="System" />
35
+ <Reference Include="System.Core">
36
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
37
+ </Reference>
38
+ <Reference Include="System.Xml.Linq">
39
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
40
+ </Reference>
41
+ <Reference Include="System.Data.DataSetExtensions">
42
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
43
+ </Reference>
44
+ <Reference Include="System.Data" />
45
+ <Reference Include="System.Xml" />
46
+ </ItemGroup>
47
+ <ItemGroup>
48
+ <Compile Include="Class1.cs" />
49
+ <Compile Include="Properties\AssemblyInfo.cs" />
50
+ </ItemGroup>
51
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
52
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
53
+ Other similar extension points exist, see Microsoft.Common.targets.
54
+ <Target Name="BeforeBuild">
55
+ </Target>
56
+ <Target Name="AfterBuild">
57
+ </Target>
58
+ -->
59
+ </Project>
@@ -0,0 +1,42 @@
1
+ require 'albacore/assemblyinfo'
2
+
3
+ class AssemblyInfoTester < AssemblyInfo
4
+
5
+ attr_accessor :assemblyinfo_file
6
+
7
+ def initialize
8
+ @version = "0.0.0.1"
9
+ @title = "some assembly title"
10
+ @description = "some assembly description goes here."
11
+ @copyright = "some copyright info goes here"
12
+ @com_visible = false
13
+ @com_guid = "dbabb27c-a536-4b5b-91f1-2226b6e3655c"
14
+ @company_name = "some company name"
15
+ @product_name = "my product, yo."
16
+ @file_version = "1.0.0.0"
17
+ @trademark = "some trademark info goes here"
18
+
19
+ setup_assemblyinfo_file
20
+ end
21
+
22
+ def setup_assemblyinfo_file
23
+ @assemblyinfo_file = File.join(File.dirname(__FILE__), "AssemblyInfo", "AssemblyInfo.cs")
24
+ File.delete @assemblyinfo_file if File.exist? @assemblyinfo_file
25
+ end
26
+
27
+ def build_and_read_assemblyinfo_file(assemblyinfo)
28
+ assemblyinfo.output_file = @assemblyinfo_file
29
+ assemblyinfo.write
30
+
31
+ contents = ''
32
+ File.open(@assemblyinfo_file, "r") do |f|
33
+ contents = f.read
34
+ end
35
+ contents
36
+ end
37
+
38
+ def yaml_file
39
+ return File.join(File.dirname(__FILE__), "AssemblyInfo", "assemblyinfo.yml")
40
+ end
41
+
42
+ end
@@ -0,0 +1,3 @@
1
+ a: a template file
2
+ b: multiple
3
+ c: values
@@ -0,0 +1,11 @@
1
+ a: a template file
2
+ b: multiple
3
+ c: values
4
+ value: 'not the right one!!!'
5
+
6
+ sample-badname.config:
7
+ value: 'the sample value'
8
+
9
+ multipleinstance.config:
10
+ value: 'the real value'
11
+ b: this is a second value
@@ -0,0 +1,4 @@
1
+ a: a template file
2
+ b: multiple
3
+ c: values
4
+ value: 'the real value'
@@ -0,0 +1 @@
1
+ value: 'the real value'
@@ -0,0 +1,4 @@
1
+ first instance of '#{value}' is here.
2
+ second instance of '#{value}' goes here.
3
+ the value of a is #{a}
4
+ b has a value of #{b}
@@ -0,0 +1 @@
1
+ this is #{a} with #{b} #{c}
@@ -0,0 +1 @@
1
+ this is #{value}
@@ -0,0 +1,69 @@
1
+ class ExpandTemplatesTestData
2
+
3
+ def initialize
4
+ @rootfolder = File.join(File.dirname(__FILE__), "expandtemplates")
5
+ @templatefolder = File.join(@rootfolder, "templates")
6
+ @workingfolder = File.join(@rootfolder, "working")
7
+ @outputfolder = File.join(@rootfolder, "output")
8
+ @datafilesfolder = File.join(@rootfolder, "datafiles")
9
+ create_working_folder
10
+ end
11
+
12
+ def create_working_folder
13
+ Dir.mkdir(@workingfolder) unless File.exist?(@workingfolder)
14
+ end
15
+
16
+ def prep_sample_templates
17
+ FileUtils.rm(Dir.glob(File.join(@workingfolder, "*")))
18
+ sleep(1)
19
+
20
+ Dir.glob(File.join(@templatefolder, "*")){|f|
21
+ FileUtils.copy(f, @workingfolder)
22
+ }
23
+ end
24
+
25
+ def sample_template_file
26
+ File.join(@workingfolder, "sample.config")
27
+ end
28
+
29
+ def multipleinstance_template_file
30
+ File.join(@workingfolder, "multipleinstance.config")
31
+ end
32
+
33
+ def sample_output_file
34
+ File.join(@workingfolder, "this_is_an_output_file.config")
35
+ end
36
+
37
+ def multiplevalues_template_file
38
+ File.join(@workingfolder, "multiplevalues.config")
39
+ end
40
+
41
+ def multiplevalues_output_file
42
+ File.join(@workingfolder, "multiplevalues_output_file.config")
43
+ end
44
+
45
+ def sample_data_file
46
+ File.join(@datafilesfolder, "sample.yml")
47
+ end
48
+
49
+ def multiplevalues_data_file
50
+ File.join(@datafilesfolder, "multiplevalues.yml")
51
+ end
52
+
53
+ def multitemplate_data_file
54
+ File.join(@datafilesfolder, "multitemplate.yml")
55
+ end
56
+
57
+ def multitemplate_specificfile_data_file
58
+ File.join(@datafilesfolder, "multitemplate-specificfile.yml")
59
+ end
60
+
61
+ def read_file(file)
62
+ filedata = ''
63
+ File.open(file, "r") {|f|
64
+ filedata = f.read
65
+ }
66
+ filedata
67
+ end
68
+
69
+ end
@@ -0,0 +1,32 @@
1
+ require 'albacore/msbuild'
2
+
3
+ class MSBuildTestData
4
+
5
+ attr_accessor :msbuild_path, :solution_path, :config_mode, :output_path
6
+
7
+ def initialize(config_mode='Debug')
8
+ @solution_path = File.join(File.dirname(__FILE__), "../", "support", "TestSolution", "TestSolution.sln")
9
+ @msbuild_path = "C:\\Windows/Microsoft.NET/Framework/v3.5/MSBuild.exe"
10
+ @config_mode = config_mode
11
+
12
+ setup_output
13
+ end
14
+
15
+ def setup_output
16
+ @output_path = File.join(File.dirname(__FILE__), "../", "support", "TestSolution", "TestSolution", "bin", "#{@config_mode}", "TestSolution.dll")
17
+ File.delete @output_path if File.exist? @output_path
18
+ end
19
+
20
+ def msbuild(path_to_msbuild=nil)
21
+ @msbuild = MSBuild.new
22
+
23
+ if (path_to_msbuild)
24
+ @msbuild_path = path_to_msbuild
25
+ (@msbuild.path_to_command = path_to_msbuild)
26
+ end
27
+
28
+ @msbuild.extend(SystemPatch)
29
+ @msbuild
30
+ end
31
+
32
+ end
@@ -0,0 +1,26 @@
1
+ class NCoverReportTestData
2
+ @filedir = File.dirname(__FILE__)
3
+ @output_folder = File.expand_path(File.join(@filedir, "CodeCoverage", "report", "output"))
4
+
5
+ def self.path_to_command
6
+ File.expand_path(File.join(@filedir, "Tools", "NCover-v3.3", "NCover.Reporting.exe"))
7
+ end
8
+
9
+ def self.coverage_file
10
+ File.expand_path(File.join(@filedir, "CodeCoverage", "report", "coverage.xml"))
11
+ end
12
+
13
+ def self.output_folder
14
+ @output_folder
15
+ end
16
+
17
+ def self.clean_output_folder
18
+ FileUtils.rmtree(@output_folder)
19
+ Dir.mkdir(@output_folder) unless File.exist?(@output_folder)
20
+ sleep(3) # this is a hack to work around the slow hard drive in my laptop, which caused failing tests w/ write-through-cache.
21
+ end
22
+
23
+ def self.summary_output_file
24
+ File.join(NCoverReportTestData.output_folder, "summary.html")
25
+ end
26
+ end
@@ -0,0 +1,15 @@
1
+ @root_dir = File.expand_path(File.join(File.dirname(__FILE__), "../../"))
2
+
3
+ $: << File.join(@root_dir, "lib")
4
+ $: << File.join(@root_dir, "spec")
5
+ $: << File.join(@root_dir, "spec/patches")
6
+ $: << File.join(@root_dir, "spec/support")
7
+
8
+ require 'not_a_mock'
9
+ require 'system_patch'
10
+ require 'tasklib_patch'
11
+
12
+ Spec::Runner.configure do |config|
13
+ config.mock_with NotAMock::RspecMockFrameworkAdapter
14
+ end
15
+
@@ -0,0 +1,4 @@
1
+ some_name: some value
2
+ another_name: another value
3
+ a_hash: {name: value, foo: bar}
4
+ what_ever: :a_symbol
@@ -0,0 +1 @@
1
+ this is a sub file for the zip task.
@@ -0,0 +1 @@
1
+ this is a test file for the zip task
@@ -0,0 +1,8 @@
1
+ class ZipTestData
2
+
3
+ @@folder = File.expand_path(File.join(File.dirname(__FILE__), 'zip'))
4
+
5
+ def self.folder
6
+ @@folder
7
+ end
8
+ end
@@ -0,0 +1,62 @@
1
+ require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
2
+ require 'albacore/support/yamlconfig'
3
+
4
+ class YamlTest
5
+ include YAMLConfig
6
+ attr_accessor :some_name
7
+ end
8
+
9
+ describe YAMLConfig, "when configuring with yaml" do
10
+ before :all do
11
+ @yml = YamlTest.new
12
+ @yml.configure File.join(File.dirname(__FILE__), 'support', 'test.yml')
13
+ end
14
+
15
+ it "should set the value of some_name" do
16
+ @yml.some_name.should == "some value"
17
+ end
18
+
19
+ it "should create and set the value of another_name" do
20
+ @yml.another_name.should == "another value"
21
+ end
22
+
23
+ it "should allow hash tables" do
24
+ @yml.a_hash.length.should == 2
25
+ @yml.a_hash['name'].should == "value"
26
+ @yml.a_hash['foo'].should == "bar"
27
+ end
28
+
29
+ it "should allow symbols" do
30
+ @yml.what_ever.should == :a_symbol
31
+ end
32
+ end
33
+
34
+ describe YAMLConfig, "when included yamlconfig in a class" do
35
+
36
+ class YAML_AutoConfig_Test
37
+ include YAMLConfig
38
+ end
39
+
40
+ before :all do
41
+ @yamltest = YAML_AutoConfig_Test.new
42
+ end
43
+
44
+ it "should automatically configure the class through a yaml file named after the class" do
45
+ @yamltest.this_attr_was_automatically_added_by.should == "the yaml auto config"
46
+ end
47
+ end
48
+
49
+ describe YAMLConfig, "when extending a class with yamlconfig" do
50
+
51
+ class YAML_AutoConfig_Test
52
+ end
53
+
54
+ before :all do
55
+ @yamltest = YAML_AutoConfig_Test.new
56
+ @yamltest.extend YAMLConfig
57
+ end
58
+
59
+ it "should automatically configure the class through a yaml file named after the class" do
60
+ @yamltest.this_attr_was_automatically_added_by.should == "the yaml auto config"
61
+ end
62
+ end
@@ -0,0 +1,18 @@
1
+ require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
2
+ require 'albacore/zipdirectory'
3
+ require 'ziptestdata'
4
+
5
+ describe ZipDirectory, 'when zipping a directory of files' do
6
+ before :each do
7
+ zip = ZipDirectory.new
8
+ puts "#{ZipTestData.folder}"
9
+ zip.directory_to_zip = ZipTestData.folder
10
+ zip.file = "test.zip"
11
+ zip.package
12
+ end
13
+
14
+ it "should prodice a zip file" do
15
+ File.exist?(File.join(ZipTestData.folder, "test.zip")).should be_true
16
+ end
17
+ end
18
+
@@ -0,0 +1,31 @@
1
+ require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
2
+ require 'albacore/zipdirectory'
3
+ require 'rake/ziptask'
4
+ require 'tasklib_patch'
5
+
6
+ describe Albacore::ZipTask, "when running" do
7
+ before :all do
8
+ task = Albacore::ZipTask.new() do |t|
9
+ @yielded_object = t
10
+ end
11
+ task.extend(TasklibPatch)
12
+ Rake::Task[:zip].invoke
13
+ end
14
+
15
+ it "should yield the zip api" do
16
+ @yielded_object.kind_of?(ZipDirectory).should be_true
17
+ end
18
+ end
19
+
20
+ describe Albacore::ZipTask, "when execution fails" do
21
+ before :all do
22
+ @task = Albacore::ZipTask.new(:failingtask)
23
+ @task.extend(TasklibPatch)
24
+ Rake::Task["failingtask"].invoke
25
+ @task.fail
26
+ end
27
+
28
+ it "should fail the rake task" do
29
+ @task.task_failed.should == true
30
+ end
31
+ end