albacore 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +84 -81
- data/VERSION +1 -1
- data/install_dependencies.rb +10 -10
- data/lib/albacore.rb +10 -2
- data/lib/albacore/assemblyinfo.rb +100 -100
- data/lib/albacore/assemblyinfolanguages/csharpengine.rb +14 -0
- data/lib/albacore/assemblyinfolanguages/vbnetengine.rb +14 -0
- data/lib/albacore/docu.rb +39 -0
- data/lib/albacore/exec.rb +23 -0
- data/lib/albacore/expandtemplates.rb +73 -71
- data/lib/albacore/msbuild.rb +56 -61
- data/lib/albacore/mspectestrunner.rb +44 -42
- data/lib/albacore/nant.rb +39 -0
- data/lib/albacore/ncoverconsole.rb +68 -61
- data/lib/albacore/ncoverreport.rb +56 -55
- data/lib/albacore/ncoverreports/assemblyfilter.rb +7 -7
- data/lib/albacore/ncoverreports/branchcoverage.rb +7 -7
- data/lib/albacore/ncoverreports/classfilter.rb +5 -5
- data/lib/albacore/ncoverreports/codecoveragebase.rb +22 -22
- data/lib/albacore/ncoverreports/cyclomaticcomplexity.rb +19 -19
- data/lib/albacore/ncoverreports/documentfilter.rb +5 -5
- data/lib/albacore/ncoverreports/fullcoveragereport.rb +17 -17
- data/lib/albacore/ncoverreports/methodcoverage.rb +7 -7
- data/lib/albacore/ncoverreports/methodfilter.rb +5 -5
- data/lib/albacore/ncoverreports/namespacefilter.rb +5 -5
- data/lib/albacore/ncoverreports/reportfilterbase.rb +23 -23
- data/lib/albacore/ncoverreports/summaryreport.rb +18 -18
- data/lib/albacore/ncoverreports/symbolcoverage.rb +6 -7
- data/lib/albacore/ndepend.rb +35 -0
- data/lib/albacore/nunittestrunner.rb +36 -35
- data/lib/albacore/plink.rb +48 -0
- data/lib/albacore/sftp.rb +33 -31
- data/lib/albacore/sqlcmd.rb +54 -51
- data/lib/albacore/ssh.rb +35 -33
- data/lib/albacore/support/albacore_helper.rb +1 -4
- data/lib/albacore/support/attrmethods.rb +25 -0
- data/lib/albacore/support/failure.rb +17 -17
- data/lib/albacore/support/globalconfig.rb +6 -0
- data/lib/albacore/support/logging.rb +30 -28
- data/lib/albacore/support/runcommand.rb +41 -41
- data/lib/albacore/support/yamlconfig.rb +23 -27
- data/lib/albacore/unzip.rb +28 -0
- data/lib/albacore/xbuild.rb +54 -0
- data/lib/albacore/xunittestrunner.rb +40 -43
- data/lib/albacore/zipdirectory.rb +72 -63
- data/lib/rake/assemblyinfotask.rb +12 -11
- data/lib/rake/docutask.rb +17 -0
- data/lib/rake/exectask.rb +18 -0
- data/lib/rake/expandtemplatestask.rb +12 -11
- data/lib/rake/msbuildtask.rb +13 -12
- data/lib/rake/mspectask.rb +12 -11
- data/lib/rake/nanttask.rb +17 -0
- data/lib/rake/ncoverconsoletask.rb +12 -11
- data/lib/rake/ncoverreporttask.rb +12 -11
- data/lib/rake/ndependtask.rb +23 -0
- data/lib/rake/nunittask.rb +12 -11
- data/lib/rake/plinktask.rb +23 -0
- data/lib/rake/renametask.rb +15 -15
- data/lib/rake/sftptask.rb +11 -10
- data/lib/rake/sqlcmdtask.rb +13 -12
- data/lib/rake/sshtask.rb +11 -10
- data/lib/rake/support/albacoretask.rb +16 -15
- data/lib/rake/unziptask.rb +17 -0
- data/lib/rake/xbuildtask.rb +22 -0
- data/lib/rake/xunittask.rb +12 -11
- data/lib/rake/ziptask.rb +12 -11
- data/rakefile.rb +255 -204
- data/spec/assemblyinfo_spec.rb +426 -221
- data/spec/assemblyinfotask_spec.rb +21 -21
- data/spec/docu_spec.rb +70 -0
- data/spec/docutask_spec.rb +39 -0
- data/spec/exec_spec.rb +23 -0
- data/spec/exectask_spec.rb +31 -0
- data/spec/expandtemplates_spec.rb +149 -148
- data/spec/expandtemplatestask_spec.rb +21 -21
- data/spec/msbuild_spec.rb +150 -139
- data/spec/msbuildtask_spec.rb +21 -21
- data/spec/mspectask_spec.rb +21 -21
- data/spec/nant_spec.rb +101 -0
- data/spec/nanttask_spec.rb +31 -0
- data/spec/ncoverconsole_spec.rb +253 -221
- data/spec/ncoverconsoletask_spec.rb +21 -21
- data/spec/ncoverreport_spec.rb +538 -523
- data/spec/ncoverreporttask_spec.rb +21 -21
- data/spec/ndepend_spec.rb +49 -0
- data/spec/{commandtask_spec.rb → ndependtask_spec.rb} +10 -10
- data/spec/nunittask_spec.rb +21 -21
- data/spec/nunittestrunner_spec.rb +6 -6
- data/spec/patches/docu_patch.rb +13 -0
- data/spec/patches/system_patch.rb +18 -18
- data/spec/patches/tasklib_patch.rb +10 -10
- data/spec/plink_spec.rb +61 -0
- data/spec/plinktask_spec.rb +31 -0
- data/spec/renametask_spec.rb +21 -21
- data/spec/sftp_spec.rb +24 -24
- data/spec/sftptask_spec.rb +31 -31
- data/spec/sqlcmd_spec.rb +118 -120
- data/spec/sqlcmdtask_spec.rb +21 -21
- data/spec/ssh_spec.rb +36 -37
- data/spec/sshtask_spec.rb +29 -29
- data/spec/support/TestSolution/NDependProject.xml +315 -0
- data/spec/support/TestSolution/TestSolution.XUnitTests/Class1.cs +12 -12
- data/spec/support/TestSolution/TestSolution.XUnitTests/FailingTestFixture.cs +14 -0
- data/spec/support/TestSolution/TestSolution.XUnitTests/TestSolution.XUnitTests.csproj +1 -0
- data/spec/support/TestSolution/TestSolution.build +25 -0
- data/spec/support/assemblyinfotester.rb +40 -38
- data/spec/support/expandtemplatestestdata.rb +73 -73
- data/spec/support/msbuildtestdata.rb +28 -28
- data/spec/support/nanttestdata.rb +33 -0
- data/spec/support/ncoverconsoletestdata.rb +18 -0
- data/spec/support/ncoverreporttestdata.rb +24 -24
- data/spec/support/spec_helper.rb +2 -1
- data/spec/support/yamlconfig/msbuild.yml +3 -0
- data/spec/support/yamlconfig/yaml_autoconfig_test.yml +1 -0
- data/spec/support/ziptestdata.rb +11 -6
- data/spec/xunit_spec.rb +63 -0
- data/spec/xunittask_spec.rb +19 -19
- data/spec/yamlconfig_spec.rb +38 -52
- data/spec/zip_spec.rb +56 -11
- data/spec/ziptask_spec.rb +22 -22
- metadata +53 -8
- data/lib/albacore/command.rb +0 -23
- data/lib/rake/commandtask.rb +0 -16
- data/spec/command_spec.rb +0 -23
@@ -4,28 +4,28 @@ require 'rake/assemblyinfotask'
|
|
4
4
|
require 'tasklib_patch'
|
5
5
|
|
6
6
|
describe Albacore::AssemblyInfoTask, "when running" do
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
7
|
+
before :all do
|
8
|
+
@task = Albacore::AssemblyInfoTask.new(:task) do |t|
|
9
|
+
@yielded_object = t
|
10
|
+
end
|
11
|
+
@task.extend(TasklibPatch)
|
12
|
+
Rake::Task["task"].invoke
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should yield the assembly info api" do
|
16
|
+
@yielded_object.kind_of?(AssemblyInfo).should == true
|
17
|
+
end
|
18
18
|
end
|
19
19
|
|
20
20
|
describe Albacore::AssemblyInfoTask, "when execution fails" do
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
21
|
+
before :all do
|
22
|
+
@task = Albacore::AssemblyInfoTask.new(:failingtask)
|
23
|
+
@task.extend(TasklibPatch)
|
24
|
+
@task.fail
|
25
|
+
Rake::Task["failingtask"].invoke
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should fail the rake task" do
|
29
|
+
@task.task_failed.should == true
|
30
|
+
end
|
31
31
|
end
|
data/spec/docu_spec.rb
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
|
2
|
+
require 'albacore/docu'
|
3
|
+
require 'docu_patch'
|
4
|
+
|
5
|
+
describe Docu, "when building docs without any assemblies specified" do
|
6
|
+
before :all do
|
7
|
+
@docu = Docu.new
|
8
|
+
@docu.execute
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should fail with a missing assemblies message" do
|
12
|
+
@docu.failed.should be_true
|
13
|
+
@docu.failure_message.should eql('Docu Failed. No assemblies specified')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe Docu, "when building docs fails" do
|
18
|
+
before :all do
|
19
|
+
@docu = Docu.new
|
20
|
+
@docu.command_result = false
|
21
|
+
@docu.assemblies 'test.dll'
|
22
|
+
@docu.execute
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should fail with a generic message" do
|
26
|
+
@docu.failed.should be_true
|
27
|
+
@docu.failure_message.should eql('Docu Failed. See Build Log For Detail')
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe Docu, "when building docs with assemblies specified" do
|
32
|
+
before :all do
|
33
|
+
@docu = Docu.new
|
34
|
+
@docu.command_result = true
|
35
|
+
@docu.assemblies 'test.dll'
|
36
|
+
@docu.execute
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should pass the assemblies in the command-line arguments" do
|
40
|
+
@docu.command_parameters.should include('test.dll')
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe Docu, "when building docs with assemblies and xml files specified" do
|
45
|
+
before :all do
|
46
|
+
@docu = Docu.new
|
47
|
+
@docu.command_result = true
|
48
|
+
@docu.xml_files 'test.xml'
|
49
|
+
@docu.assemblies 'test.dll'
|
50
|
+
@docu.execute
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should pass the xml files in the command-line arguments after the assemblies" do
|
54
|
+
@docu.command_parameters.should include('test.dll test.xml')
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe Docu, "when building docs with an output location specified" do
|
59
|
+
before :all do
|
60
|
+
@docu = Docu.new
|
61
|
+
@docu.command_result = true
|
62
|
+
@docu.assemblies 'test.dll'
|
63
|
+
@docu.output_location = 'output_location'
|
64
|
+
@docu.execute
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should pass the output location using the --output switch" do
|
68
|
+
@docu.command_parameters.should include('--output="output_location"')
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
|
2
|
+
require 'albacore/docu'
|
3
|
+
require 'rake/docutask'
|
4
|
+
require 'tasklib_patch'
|
5
|
+
require 'docu_patch'
|
6
|
+
|
7
|
+
describe Albacore::DocuTask, "when running" do
|
8
|
+
before :all do
|
9
|
+
task = Albacore::DocuTask.new(:successful_task) do |t|
|
10
|
+
t.assemblies << 'test.dll'
|
11
|
+
t.command_result = true
|
12
|
+
@yielded_object = t
|
13
|
+
end
|
14
|
+
|
15
|
+
task.extend(TasklibPatch)
|
16
|
+
Rake::Task[:successful_task].invoke
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should yield the docu api" do
|
20
|
+
@yielded_object.kind_of?(Docu).should be_true
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe Albacore::DocuTask, "when execution fails" do
|
25
|
+
before :all do
|
26
|
+
@task = Albacore::DocuTask.new(:failing_task) do |t|
|
27
|
+
t.command_result = false
|
28
|
+
t.assemblies << 'test.dll'
|
29
|
+
end
|
30
|
+
|
31
|
+
@task.extend(TasklibPatch)
|
32
|
+
|
33
|
+
Rake::Task[:failing_task].invoke
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should fail the rake task" do
|
37
|
+
@task.task_failed.should == true
|
38
|
+
end
|
39
|
+
end
|
data/spec/exec_spec.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
|
2
|
+
require 'albacore/exec'
|
3
|
+
|
4
|
+
@@nunit = File.join(File.dirname(__FILE__), 'support', 'Tools', 'NUnit-v2.5', 'nunit-console-x86.exe')
|
5
|
+
|
6
|
+
describe Exec, "when executing a command with parameters" do
|
7
|
+
before :all do
|
8
|
+
@cmd = Exec.new
|
9
|
+
@cmd.log_level = :verbose
|
10
|
+
@cmd.extend(SystemPatch)
|
11
|
+
@cmd.path_to_command = @@nunit
|
12
|
+
@cmd.parameters "--help"
|
13
|
+
@cmd.execute
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should run the command with the parameters" do
|
17
|
+
@cmd.system_command.should include("\"#{@@nunit}\" --help")
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should not fail" do
|
21
|
+
@cmd.failed.should be_false
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
|
2
|
+
require 'albacore/exec'
|
3
|
+
require 'rake/exectask'
|
4
|
+
require 'tasklib_patch'
|
5
|
+
|
6
|
+
describe Albacore::ExecTask, "when running" do
|
7
|
+
before :all do
|
8
|
+
task = Albacore::ExecTask.new(:exec) do |t|
|
9
|
+
@yielded_object = t
|
10
|
+
end
|
11
|
+
task.extend(TasklibPatch)
|
12
|
+
Rake::Task[:exec].invoke
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should yield the exec api" do
|
16
|
+
@yielded_object.kind_of?(Exec).should == true
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe Albacore::ExecTask, "when execution fails" do
|
21
|
+
before :all do
|
22
|
+
@task = Albacore::ExecTask.new(:failingtask)
|
23
|
+
@task.extend(TasklibPatch)
|
24
|
+
@task.fail
|
25
|
+
Rake::Task["failingtask"].invoke
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should fail the rake task" do
|
29
|
+
@task.task_failed.should be_true
|
30
|
+
end
|
31
|
+
end
|
@@ -3,177 +3,178 @@ require 'albacore/expandtemplates'
|
|
3
3
|
require 'expandtemplatestestdata'
|
4
4
|
|
5
5
|
shared_examples_for "prepping the sample templates" do
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
6
|
+
before :all do
|
7
|
+
@testdata = ExpandTemplatesTestData.new
|
8
|
+
@testdata.prep_sample_templates
|
9
|
+
|
10
|
+
@templates = ExpandTemplates.new
|
11
|
+
@templates.log_level = :verbose
|
12
|
+
end
|
13
13
|
end
|
14
14
|
|
15
15
|
describe ExpandTemplates, "when expanding a single value into multiple locations" do
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
16
|
+
it_should_behave_like "prepping the sample templates"
|
17
|
+
|
18
|
+
before :all do
|
19
|
+
@templates.expand_files @testdata.multipleinstance_template_file => @testdata.multipleinstance_template_file
|
20
|
+
@templates.data_file = @testdata.sample_data_file
|
21
|
+
@templates.expand
|
22
|
+
|
23
|
+
@output_file_data = @testdata.read_file(@testdata.multipleinstance_template_file)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should replace the first location" do
|
27
|
+
@output_file_data.should include("first instance of 'the real value' is here.")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should replace the second location" do
|
31
|
+
@output_file_data.should include("second instance of 'the real value' goes here.")
|
32
|
+
end
|
33
33
|
end
|
34
34
|
|
35
35
|
describe ExpandTemplates, "when expanding multiples value into multiple locations" do
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
36
|
+
it_should_behave_like "prepping the sample templates"
|
37
|
+
|
38
|
+
before :all do
|
39
|
+
@templates.expand_files @testdata.multiplevalues_template_file => @testdata.multiplevalues_output_file
|
40
|
+
@templates.data_file = @testdata.multiplevalues_data_file
|
41
|
+
@templates.expand
|
42
|
+
|
43
|
+
@output_file_data = @testdata.read_file(@testdata.multiplevalues_output_file)
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should replace the values" do
|
47
|
+
@output_file_data.should include("this is a template file with multiple values")
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should write to the specified output file" do
|
51
|
+
File.exist?(@testdata.multiplevalues_output_file).should be_true
|
52
|
+
end
|
53
53
|
end
|
54
54
|
|
55
55
|
describe ExpandTemplates, "when expanding a template file and specifying an output file" do
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
56
|
+
it_should_behave_like "prepping the sample templates"
|
57
|
+
|
58
|
+
before :all do
|
59
|
+
@templates.expand_files @testdata.sample_template_file => @testdata.sample_output_file
|
60
|
+
@templates.data_file = @testdata.sample_data_file
|
61
|
+
@templates.expand
|
62
|
+
|
63
|
+
@output_file_data = @testdata.read_file(@testdata.sample_output_file)
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should replace the \#{value} placeholder with 'the real value'" do
|
67
|
+
@output_file_data.should include("the real value")
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should write to the specified output file" do
|
71
|
+
File.exist?(@testdata.sample_output_file).should be_true
|
72
|
+
end
|
73
73
|
end
|
74
74
|
|
75
75
|
describe ExpandTemplates, "when expanding multiple template files" do
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
76
|
+
it_should_behave_like "prepping the sample templates"
|
77
|
+
|
78
|
+
before :all do
|
79
|
+
@templates.expand_files(
|
80
|
+
@testdata.multipleinstance_template_file => @testdata.multipleinstance_template_file,
|
81
|
+
@testdata.sample_template_file => @testdata.sample_output_file,
|
82
|
+
@testdata.multiplevalues_template_file => @testdata.multiplevalues_output_file
|
83
|
+
)
|
84
|
+
|
85
|
+
@templates.data_file = @testdata.multitemplate_data_file
|
86
|
+
@templates.expand
|
87
|
+
|
88
|
+
@output_file_data = @testdata.read_file(@testdata.multipleinstance_template_file)
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should expand the first template right onto itself" do
|
92
|
+
@output_file_data.should include("first instance of 'the real value' is here.")
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should expand the second template to the specified location" do
|
96
|
+
File.exist?(@testdata.sample_output_file).should be_true
|
97
|
+
end
|
97
98
|
end
|
98
99
|
|
99
100
|
describe ExpandTemplates, "when expanding template files and the data file contains entries for specific templates" do
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
101
|
+
it_should_behave_like "prepping the sample templates"
|
102
|
+
|
103
|
+
before :all do
|
104
|
+
@templates.expand_files(
|
105
|
+
@testdata.multipleinstance_template_file => @testdata.multipleinstance_template_file,
|
106
|
+
@testdata.sample_template_file => @testdata.sample_output_file,
|
107
|
+
@testdata.multiplevalues_template_file => @testdata.multiplevalues_output_file
|
108
|
+
)
|
109
|
+
@templates.data_file = @testdata.multitemplate_specificfile_data_file
|
110
|
+
@templates.expand
|
111
|
+
|
112
|
+
@multiinstance_file_data = @testdata.read_file(@testdata.multipleinstance_template_file)
|
113
|
+
@sample_file_data = @testdata.read_file(@testdata.sample_output_file)
|
114
|
+
end
|
115
|
+
|
116
|
+
it "should expand the specific template with the data specified for it" do
|
117
|
+
@multiinstance_file_data.should include("first instance of 'the real value' is here.")
|
118
|
+
@multiinstance_file_data.should include("b has a value of this is a second value")
|
119
|
+
end
|
120
|
+
|
121
|
+
it "should use the global data when data for a specific template is not found in that templates specific data" do
|
122
|
+
@multiinstance_file_data.should include("the value of a is a template file")
|
123
|
+
end
|
123
124
|
|
124
|
-
|
125
|
-
|
126
|
-
|
125
|
+
it "should not use the data from specified templates when the template name does not match" do
|
126
|
+
@sample_file_data.should include("this is not the right one!!!")
|
127
|
+
end
|
127
128
|
end
|
128
129
|
|
129
130
|
describe ExpandTemplates, "when including external data and specified placeholder is not found in local data" do
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
131
|
+
it_should_behave_like "prepping the sample templates"
|
132
|
+
|
133
|
+
before :all do
|
134
|
+
@templates.expand_files @testdata.multipleinstance_template_file => @testdata.multipleinstance_template_file
|
135
|
+
@templates.data_file = @testdata.sample_data_file_with_include
|
136
|
+
@templates.expand
|
137
|
+
|
138
|
+
@output_file_data = @testdata.read_file(@testdata.multipleinstance_template_file)
|
139
|
+
end
|
140
|
+
|
141
|
+
it "should use data from the included file" do
|
142
|
+
@output_file_data.should include("first instance of 'the real value' is here.")
|
143
|
+
end
|
143
144
|
end
|
144
145
|
|
145
146
|
describe ExpandTemplates, "when including external data and specified placeholder is found in local data" do
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
147
|
+
it_should_behave_like "prepping the sample templates"
|
148
|
+
|
149
|
+
before :all do
|
150
|
+
@templates.expand_files @testdata.multipleinstance_template_file => @testdata.multipleinstance_template_file
|
151
|
+
@templates.data_file = @testdata.sample_data_file_with_include
|
152
|
+
@templates.expand
|
153
|
+
|
154
|
+
@output_file_data = @testdata.read_file(@testdata.multipleinstance_template_file)
|
155
|
+
end
|
156
|
+
|
157
|
+
it "should use data from the local file" do
|
158
|
+
@output_file_data.should include("the value of a is data")
|
159
|
+
end
|
159
160
|
end
|
160
161
|
|
161
162
|
describe ExpandTemplates, "when when external data includes at least part of the data for a specific template" do
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
163
|
+
it_should_behave_like "prepping the sample templates"
|
164
|
+
|
165
|
+
before :all do
|
166
|
+
@templates.expand_files @testdata.multipleinstance_template_file => @testdata.multipleinstance_template_file
|
167
|
+
@templates.data_file = @testdata.template_specific_data_file_with_include
|
168
|
+
@templates.expand
|
169
|
+
|
170
|
+
@output_file_data = @testdata.read_file(@testdata.multipleinstance_template_file)
|
171
|
+
end
|
172
|
+
|
173
|
+
it "should use the external data that was supplied" do
|
174
|
+
@output_file_data.should include("the value of a is data")
|
175
|
+
end
|
176
|
+
|
177
|
+
it "should override the external data with template specific data from the local file" do
|
178
|
+
@output_file_data.should include("first instance of 'the real value' is here.")
|
179
|
+
end
|
179
180
|
end
|