buildr 1.3.2-java → 1.3.3-java
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.
- data/CHANGELOG +66 -4
- data/{README → README.rdoc} +29 -16
- data/Rakefile +16 -20
- data/_buildr +38 -0
- data/addon/buildr/cobertura.rb +49 -45
- data/addon/buildr/emma.rb +238 -0
- data/addon/buildr/jetty.rb +1 -1
- data/addon/buildr/nailgun.rb +585 -661
- data/{lib/buildr/java → addon/buildr}/org/apache/buildr/BuildrNail$Main.class +0 -0
- data/{lib/buildr/java → addon/buildr}/org/apache/buildr/BuildrNail.class +0 -0
- data/{lib/buildr/java → addon/buildr}/org/apache/buildr/BuildrNail.java +0 -0
- data/bin/buildr +9 -2
- data/buildr.buildfile +53 -0
- data/buildr.gemspec +21 -14
- data/doc/css/default.css +51 -48
- data/doc/css/print.css +60 -55
- data/doc/images/favicon.png +0 -0
- data/doc/images/growl-icon.tiff +0 -0
- data/doc/images/project-structure.png +0 -0
- data/doc/pages/artifacts.textile +46 -156
- data/doc/pages/building.textile +63 -323
- data/doc/pages/contributing.textile +112 -102
- data/doc/pages/download.textile +19 -27
- data/doc/pages/extending.textile +27 -81
- data/doc/pages/getting_started.textile +44 -119
- data/doc/pages/index.textile +26 -47
- data/doc/pages/languages.textile +407 -0
- data/doc/pages/more_stuff.textile +92 -173
- data/doc/pages/packaging.textile +71 -239
- data/doc/pages/projects.textile +58 -233
- data/doc/pages/recipes.textile +19 -43
- data/doc/pages/settings_profiles.textile +39 -104
- data/doc/pages/testing.textile +41 -304
- data/doc/pages/troubleshooting.textile +29 -47
- data/doc/pages/whats_new.textile +69 -167
- data/doc/print.haml +0 -1
- data/doc/print.toc.yaml +1 -0
- data/doc/scripts/buildr-git.rb +1 -1
- data/doc/site.haml +1 -0
- data/doc/site.toc.yaml +8 -5
- data/{KEYS → etc/KEYS} +0 -0
- data/etc/git-svn-authors +16 -0
- data/lib/buildr.rb +2 -5
- data/lib/buildr/core/application.rb +192 -98
- data/lib/buildr/core/build.rb +140 -91
- data/lib/buildr/core/checks.rb +5 -5
- data/lib/buildr/core/common.rb +1 -1
- data/lib/buildr/core/compile.rb +12 -10
- data/lib/buildr/core/filter.rb +151 -46
- data/lib/buildr/core/generate.rb +9 -9
- data/lib/buildr/core/progressbar.rb +1 -1
- data/lib/buildr/core/project.rb +8 -7
- data/lib/buildr/core/test.rb +51 -26
- data/lib/buildr/core/transports.rb +22 -38
- data/lib/buildr/core/util.rb +78 -26
- data/lib/buildr/groovy.rb +18 -0
- data/lib/buildr/groovy/bdd.rb +105 -0
- data/lib/buildr/groovy/compiler.rb +138 -0
- data/lib/buildr/ide/eclipse.rb +102 -71
- data/lib/buildr/ide/idea.rb +7 -12
- data/lib/buildr/ide/idea7x.rb +7 -8
- data/lib/buildr/java.rb +4 -7
- data/lib/buildr/java/ant.rb +26 -5
- data/lib/buildr/java/bdd.rb +449 -0
- data/lib/buildr/java/commands.rb +9 -9
- data/lib/buildr/java/{compilers.rb → compiler.rb} +8 -90
- data/lib/buildr/java/jruby.rb +29 -11
- data/lib/buildr/java/jtestr_runner.rb.erb +116 -0
- data/lib/buildr/java/packaging.rb +23 -16
- data/lib/buildr/java/pom.rb +1 -1
- data/lib/buildr/java/rjb.rb +21 -8
- data/lib/buildr/java/test_result.rb +308 -0
- data/lib/buildr/java/tests.rb +324 -0
- data/lib/buildr/packaging/artifact.rb +12 -11
- data/lib/buildr/packaging/artifact_namespace.rb +7 -4
- data/lib/buildr/packaging/gems.rb +3 -3
- data/lib/buildr/packaging/zip.rb +13 -10
- data/lib/buildr/resources/buildr.icns +0 -0
- data/lib/buildr/scala.rb +19 -0
- data/lib/buildr/scala/compiler.rb +109 -0
- data/lib/buildr/scala/tests.rb +203 -0
- data/rakelib/apache.rake +71 -45
- data/rakelib/doc.rake +2 -2
- data/rakelib/package.rake +3 -2
- data/rakelib/rspec.rake +23 -21
- data/rakelib/setup.rake +34 -9
- data/rakelib/stage.rake +4 -1
- data/spec/addon/cobertura_spec.rb +77 -0
- data/spec/addon/emma_spec.rb +120 -0
- data/spec/addon/test_coverage_spec.rb +255 -0
- data/spec/{application_spec.rb → core/application_spec.rb} +82 -4
- data/spec/{artifact_namespace_spec.rb → core/artifact_namespace_spec.rb} +12 -1
- data/spec/core/build_spec.rb +415 -0
- data/spec/{checks_spec.rb → core/checks_spec.rb} +2 -2
- data/spec/{common_spec.rb → core/common_spec.rb} +119 -30
- data/spec/{compile_spec.rb → core/compile_spec.rb} +17 -13
- data/spec/core/generate_spec.rb +33 -0
- data/spec/{project_spec.rb → core/project_spec.rb} +9 -6
- data/spec/{test_spec.rb → core/test_spec.rb} +222 -28
- data/spec/{transport_spec.rb → core/transport_spec.rb} +5 -9
- data/spec/groovy/bdd_spec.rb +80 -0
- data/spec/{groovy_compilers_spec.rb → groovy/compiler_spec.rb} +1 -1
- data/spec/ide/eclipse_spec.rb +243 -0
- data/spec/{java_spec.rb → java/ant.rb} +7 -17
- data/spec/java/bdd_spec.rb +358 -0
- data/spec/{java_compilers_spec.rb → java/compiler_spec.rb} +1 -1
- data/spec/java/java_spec.rb +88 -0
- data/spec/{java_packaging_spec.rb → java/packaging_spec.rb} +65 -4
- data/spec/{java_test_frameworks_spec.rb → java/tests_spec.rb} +31 -10
- data/spec/{archive_spec.rb → packaging/archive_spec.rb} +12 -2
- data/spec/{artifact_spec.rb → packaging/artifact_spec.rb} +12 -5
- data/spec/{packaging_helper.rb → packaging/packaging_helper.rb} +0 -0
- data/spec/{packaging_spec.rb → packaging/packaging_spec.rb} +1 -1
- data/spec/sandbox.rb +22 -5
- data/spec/{scala_compilers_spec.rb → scala/compiler_spec.rb} +1 -1
- data/spec/{scala_test_frameworks_spec.rb → scala/tests_spec.rb} +11 -12
- data/spec/spec_helpers.rb +38 -17
- metadata +93 -70
- data/lib/buildr/java/bdd_frameworks.rb +0 -265
- data/lib/buildr/java/groovyc.rb +0 -137
- data/lib/buildr/java/test_frameworks.rb +0 -450
- data/spec/build_spec.rb +0 -193
- data/spec/java_bdd_frameworks_spec.rb +0 -238
- data/spec/spec.opts +0 -6
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
# the License.
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
require File.join(File.dirname(__FILE__), 'spec_helpers')
|
|
17
|
+
require File.join(File.dirname(__FILE__), '../spec_helpers')
|
|
18
18
|
|
|
19
19
|
describe Buildr.method(:struct) do
|
|
20
20
|
before do
|
|
@@ -110,42 +110,62 @@ describe Buildr.method(:download) do
|
|
|
110
110
|
end
|
|
111
111
|
|
|
112
112
|
it 'should accept a String and download from that URL' do
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
113
|
+
define 'foo' do
|
|
114
|
+
download('http://localhost/download').tap do |task|
|
|
115
|
+
task.source.should_receive(:read).and_yield [@content]
|
|
116
|
+
task.invoke
|
|
117
|
+
task.should contain(@content)
|
|
118
|
+
end
|
|
117
119
|
end
|
|
118
120
|
end
|
|
119
121
|
|
|
120
122
|
it 'should accept a URI and download from that URL' do
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
define 'foo' do
|
|
124
|
+
download(URI.parse('http://localhost/download')).tap do |task|
|
|
125
|
+
task.source.should_receive(:read).and_yield [@content]
|
|
126
|
+
task.invoke
|
|
127
|
+
task.should contain(@content)
|
|
128
|
+
end
|
|
125
129
|
end
|
|
126
130
|
end
|
|
127
131
|
|
|
128
132
|
it 'should accept a path and String and download from that URL' do
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
+
define 'foo' do
|
|
134
|
+
download('downloaded'=>'http://localhost/download').tap do |task|
|
|
135
|
+
task.source.should_receive(:read).and_yield [@content]
|
|
136
|
+
task.invoke
|
|
137
|
+
task.should contain(@content)
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
it 'should accept an artifact and String and download from that URL' do
|
|
143
|
+
define 'foo' do
|
|
144
|
+
artifact('com.example:library:jar:2.0').tap do |artifact|
|
|
145
|
+
download(artifact=>'http://localhost/download').source.should_receive(:read).and_yield [@content]
|
|
146
|
+
artifact.invoke
|
|
147
|
+
artifact.should contain(@content)
|
|
148
|
+
end
|
|
133
149
|
end
|
|
134
150
|
end
|
|
135
151
|
|
|
136
152
|
it 'should accept a path and URI and download from that URL' do
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
153
|
+
define 'foo' do
|
|
154
|
+
download('downloaded'=>URI.parse('http://localhost/download')).tap do |task|
|
|
155
|
+
task.source.should_receive(:read).and_yield [@content]
|
|
156
|
+
task.invoke
|
|
157
|
+
task.should contain(@content)
|
|
158
|
+
end
|
|
141
159
|
end
|
|
142
160
|
end
|
|
143
161
|
|
|
144
162
|
it 'should create path for download' do
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
163
|
+
define 'foo' do
|
|
164
|
+
download('path/downloaded'=>URI.parse('http://localhost/download')).tap do |task|
|
|
165
|
+
task.source.should_receive(:read).and_yield [@content]
|
|
166
|
+
task.invoke
|
|
167
|
+
task.should contain(@content)
|
|
168
|
+
end
|
|
149
169
|
end
|
|
150
170
|
end
|
|
151
171
|
|
|
@@ -166,10 +186,12 @@ describe Buildr.method(:download) do
|
|
|
166
186
|
end
|
|
167
187
|
|
|
168
188
|
it 'should execute only if file does not already exist' do
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
189
|
+
define 'foo' do
|
|
190
|
+
download('downloaded'=>'http://localhost/download').tap do |task|
|
|
191
|
+
task.source.should_not_receive(:read)
|
|
192
|
+
write task.to_s, 'not really'
|
|
193
|
+
task.invoke
|
|
194
|
+
end
|
|
173
195
|
end
|
|
174
196
|
end
|
|
175
197
|
|
|
@@ -282,7 +304,7 @@ describe Buildr::Filter do
|
|
|
282
304
|
|
|
283
305
|
it 'should respond to :include and use these inclusion patterns' do
|
|
284
306
|
@filter.from('src').into('target').include('file2', 'file3').run
|
|
285
|
-
Dir['target/*'].should eql(['target/file2', 'target/file3'])
|
|
307
|
+
Dir['target/*'].sort.should eql(['target/file2', 'target/file3'])
|
|
286
308
|
end
|
|
287
309
|
|
|
288
310
|
it 'should respond to :exclude and return self' do
|
|
@@ -354,6 +376,43 @@ describe Buildr::Filter do
|
|
|
354
376
|
end
|
|
355
377
|
end
|
|
356
378
|
|
|
379
|
+
it 'should use erb when given a binding' do
|
|
380
|
+
1.upto(4) { |i| write "src/file#{i}", "file#{i} with <%= key1 %> and <%= key2 * 2 %>" }
|
|
381
|
+
key1 = 'value1'
|
|
382
|
+
key2 = 12
|
|
383
|
+
@filter.from('src').into('target').using(binding).run
|
|
384
|
+
Dir['target/*'].each do |file|
|
|
385
|
+
read(file).should eql("#{File.basename(file)} with value1 and 24")
|
|
386
|
+
end
|
|
387
|
+
end
|
|
388
|
+
|
|
389
|
+
it 'should apply hash mapping using erb' do
|
|
390
|
+
1.upto(4) { |i| write "src/file#{i}", "file#{i} with <%= key1 %> and <%= key2 * 2 %>" }
|
|
391
|
+
@filter.from('src').into('target').using(:erb, 'key1'=>'value1', 'key2'=> 12).run
|
|
392
|
+
Dir['target/*'].each do |file|
|
|
393
|
+
read(file).should eql("#{File.basename(file)} with value1 and 24")
|
|
394
|
+
end
|
|
395
|
+
end
|
|
396
|
+
|
|
397
|
+
it 'should use an object binding when using erb' do
|
|
398
|
+
1.upto(4) { |i| write "src/file#{i}", "file#{i} with <%= key1 %> and <%= key2 * 2 %>" }
|
|
399
|
+
obj = Struct.new(:key1, :key2).new('value1', 12)
|
|
400
|
+
@filter.from('src').into('target').using(:erb, obj).run
|
|
401
|
+
Dir['target/*'].each do |file|
|
|
402
|
+
read(file).should eql("#{File.basename(file)} with value1 and 24")
|
|
403
|
+
end
|
|
404
|
+
end
|
|
405
|
+
|
|
406
|
+
it 'should use a given block context when using erb' do
|
|
407
|
+
1.upto(4) { |i| write "src/file#{i}", "file#{i} with <%= key1 %> and <%= key2 * 2 %>" }
|
|
408
|
+
key1 = 'value1'
|
|
409
|
+
key2 = 12
|
|
410
|
+
@filter.from('src').into('target').using(:erb){}.run
|
|
411
|
+
Dir['target/*'].each do |file|
|
|
412
|
+
read(file).should eql("#{File.basename(file)} with value1 and 24")
|
|
413
|
+
end
|
|
414
|
+
end
|
|
415
|
+
|
|
357
416
|
it 'should using Maven mapper by default' do
|
|
358
417
|
@filter.using('key1'=>'value1', 'key2'=>'value2').mapper.should eql(:maven)
|
|
359
418
|
end
|
|
@@ -430,6 +489,32 @@ describe Buildr::Filter do
|
|
|
430
489
|
end
|
|
431
490
|
end
|
|
432
491
|
|
|
492
|
+
describe Filter::Mapper do
|
|
493
|
+
|
|
494
|
+
module MooMapper
|
|
495
|
+
def moo_config(*args, &block)
|
|
496
|
+
raise ArgumentError, "Expected moo block" unless block_given?
|
|
497
|
+
{ :moos => args, :callback => block }
|
|
498
|
+
end
|
|
499
|
+
|
|
500
|
+
def moo_transform(content, path = nil)
|
|
501
|
+
content.gsub(/moo+/i) do |str|
|
|
502
|
+
moos = yield :moos # same than config[:moos]
|
|
503
|
+
moo = moos[str.size - 3] || str
|
|
504
|
+
config[:callback].call(moo)
|
|
505
|
+
end
|
|
506
|
+
end
|
|
507
|
+
end
|
|
508
|
+
|
|
509
|
+
it 'should allow plugable mapping types' do
|
|
510
|
+
mapper = Filter::Mapper.new.extend(MooMapper)
|
|
511
|
+
mapper.using(:moo, 'ooone', 'twoo') do |str|
|
|
512
|
+
i = nil; str.capitalize.gsub(/\w/) { |s| s.send( (i = !i) ? 'upcase' : 'downcase' ) }
|
|
513
|
+
end
|
|
514
|
+
mapper.transform('Moo cow, mooo cows singing mooooo').should == 'OoOnE cow, TwOo cows singing MoOoOo'
|
|
515
|
+
end
|
|
516
|
+
|
|
517
|
+
end
|
|
433
518
|
|
|
434
519
|
describe Buildr.method(:options) do
|
|
435
520
|
it 'should return an Options object' do
|
|
@@ -446,7 +531,6 @@ describe Buildr.method(:options) do
|
|
|
446
531
|
end
|
|
447
532
|
end
|
|
448
533
|
|
|
449
|
-
|
|
450
534
|
describe Buildr::Options, 'proxy.exclude' do
|
|
451
535
|
before do
|
|
452
536
|
options.proxy.http = 'http://myproxy:8080'
|
|
@@ -551,9 +635,14 @@ name1=with\tand\r
|
|
|
551
635
|
|
|
552
636
|
name2=with\\nand\f
|
|
553
637
|
|
|
554
|
-
name3=double
|
|
638
|
+
name3=double\\\\hash
|
|
555
639
|
PROPS
|
|
556
|
-
hash.should == {'name1'=>"with\tand
|
|
640
|
+
hash.should == {'name1'=>"with\tand", 'name2'=>"with\nand\f", 'name3'=>'double\hash'}
|
|
641
|
+
end
|
|
642
|
+
|
|
643
|
+
it 'should ignore whitespace' do
|
|
644
|
+
hash = Hash.from_java_properties('name1 = value1')
|
|
645
|
+
hash.should == {'name1'=>'value1'}
|
|
557
646
|
end
|
|
558
647
|
end
|
|
559
648
|
|
|
@@ -567,7 +656,7 @@ describe Hash, '#to_java_properties' do
|
|
|
567
656
|
end
|
|
568
657
|
|
|
569
658
|
it 'should handle \t, \r, \n and \f' do
|
|
570
|
-
props = {'name1'=>"with\tand\r", 'name2'=>"with\nand\f", 'name3'=>
|
|
659
|
+
props = {'name1'=>"with\tand\r", 'name2'=>"with\nand\f", 'name3'=>'double\hash'}.to_java_properties
|
|
571
660
|
props.split("\n").should include("name1=with\\tand\\r")
|
|
572
661
|
props.split("\n").should include("name2=with\\nand\\f")
|
|
573
662
|
props.split("\n").should include("name3=double\\\\hash")
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
# the License.
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
require File.join(File.dirname(__FILE__), 'spec_helpers')
|
|
17
|
+
require File.join(File.dirname(__FILE__), '../spec_helpers')
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
module CompilerHelper
|
|
@@ -23,8 +23,8 @@ module CompilerHelper
|
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def sources
|
|
26
|
-
@sources ||= ['Test1.java', 'Test2.java'].map { |f| File.join('src/main/java', f) }.
|
|
27
|
-
each { |src| write src, "class #{src.pathmap('%n')} {}" }
|
|
26
|
+
@sources ||= ['Test1.java', 'Test2.java'].map { |f| File.join('src/main/java/thepackage', f) }.
|
|
27
|
+
each { |src| write src, "package thepackage; class #{src.pathmap('%n')} {}" }
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
def jars
|
|
@@ -146,12 +146,12 @@ describe Buildr::CompileTask, '#sources' do
|
|
|
146
146
|
|
|
147
147
|
it 'should allow files' do
|
|
148
148
|
compile_task.from(sources).into('classes').invoke
|
|
149
|
-
sources.each { |src| file(src.pathmap('classes/%n.class')).should exist }
|
|
149
|
+
sources.each { |src| file(src.pathmap('classes/thepackage/%n.class')).should exist }
|
|
150
150
|
end
|
|
151
151
|
|
|
152
152
|
it 'should allow directories' do
|
|
153
153
|
compile_task.from(File.dirname(sources.first)).into('classes').invoke
|
|
154
|
-
sources.each { |src| file(src.pathmap('classes/%n.class')).should exist }
|
|
154
|
+
sources.each { |src| file(src.pathmap('classes/thepackage/%n.class')).should exist }
|
|
155
155
|
end
|
|
156
156
|
|
|
157
157
|
it 'should allow tasks' do
|
|
@@ -179,7 +179,7 @@ describe Buildr::CompileTask, '#dependencies' do
|
|
|
179
179
|
|
|
180
180
|
it 'should allow files' do
|
|
181
181
|
compile_task.from(sources).with(jars).into('classes').invoke
|
|
182
|
-
sources.each { |src| file(src.pathmap('classes/%n.class')).should exist }
|
|
182
|
+
sources.each { |src| file(src.pathmap('classes/thepackage/%n.class')).should exist }
|
|
183
183
|
end
|
|
184
184
|
|
|
185
185
|
it 'should allow tasks' do
|
|
@@ -261,7 +261,7 @@ describe Buildr::CompileTask, '#invoke' do
|
|
|
261
261
|
|
|
262
262
|
it 'should compile into target directory' do
|
|
263
263
|
compile_task.from(sources).into('code').invoke
|
|
264
|
-
Dir['code/*.class'].should_not be_empty
|
|
264
|
+
Dir['code/thepackage/*.class'].should_not be_empty
|
|
265
265
|
end
|
|
266
266
|
|
|
267
267
|
it 'should compile only once' do
|
|
@@ -302,7 +302,9 @@ describe Buildr::CompileTask, '#invoke' do
|
|
|
302
302
|
end
|
|
303
303
|
|
|
304
304
|
it 'should force compilation if target empty' do
|
|
305
|
+
time = Time.now
|
|
305
306
|
mkpath compile_task.target.to_s
|
|
307
|
+
File.utime(time - 1, time - 1, compile_task.target.to_s)
|
|
306
308
|
lambda { compile_task.from(sources).invoke }.should run_task('foo:compile')
|
|
307
309
|
end
|
|
308
310
|
|
|
@@ -310,15 +312,16 @@ describe Buildr::CompileTask, '#invoke' do
|
|
|
310
312
|
# Simulate class files that are older than source files.
|
|
311
313
|
time = Time.now
|
|
312
314
|
sources.each { |src| File.utime(time + 1, time + 1, src) }
|
|
313
|
-
sources.map { |src| src.pathmap("#{compile_task.target}/%n.class") }.
|
|
315
|
+
sources.map { |src| src.pathmap("#{compile_task.target}/thepackage/%n.class") }.
|
|
314
316
|
each { |kls| write kls ; File.utime(time, time, kls) }
|
|
317
|
+
File.utime(time - 1, time - 1, project('foo').compile.target.to_s)
|
|
315
318
|
lambda { compile_task.from(sources).invoke }.should run_task('foo:compile')
|
|
316
319
|
end
|
|
317
320
|
|
|
318
321
|
it 'should not force compilation if sources older than compiled' do
|
|
319
322
|
# When everything has the same timestamp, nothing is compiled again.
|
|
320
323
|
time = Time.now
|
|
321
|
-
sources.map { |src| src.pathmap("#{compile_task.target}/%n.class") }.
|
|
324
|
+
sources.map { |src| src.pathmap("#{compile_task.target}/thepackage/%n.class") }.
|
|
322
325
|
each { |kls| write kls ; File.utime(time, time, kls) }
|
|
323
326
|
lambda { compile_task.from(sources).invoke }.should_not run_task('foo:compile')
|
|
324
327
|
end
|
|
@@ -327,8 +330,9 @@ describe Buildr::CompileTask, '#invoke' do
|
|
|
327
330
|
jars; project('jars').task("package").invoke
|
|
328
331
|
# On my machine the times end up the same, so need to push dependencies in the past.
|
|
329
332
|
time = Time.now
|
|
330
|
-
sources.map { |src| src.pathmap("#{compile_task.target}/%n.class") }.
|
|
331
|
-
each { |kls| write kls ; File.utime(time, time, kls) }
|
|
333
|
+
sources.map { |src| src.pathmap("#{compile_task.target}/thepackage/%n.class") }.
|
|
334
|
+
each { |kls| write kls ; File.utime(time - 1, time - 1, kls) }
|
|
335
|
+
File.utime(time - 1, time - 1, project('foo').compile.target.to_s)
|
|
332
336
|
jars.each { |jar| File.utime(time + 1, time + 1, jar) }
|
|
333
337
|
lambda { compile_task.from(sources).with(jars).invoke }.should run_task('foo:compile')
|
|
334
338
|
end
|
|
@@ -337,7 +341,7 @@ describe Buildr::CompileTask, '#invoke' do
|
|
|
337
341
|
jars; project('jars').task("package").invoke
|
|
338
342
|
time = Time.now
|
|
339
343
|
jars.each { |jar| File.utime(time - 1 , time - 1, jar) }
|
|
340
|
-
sources.map { |src| File.utime(time, time, src); src.pathmap("#{compile_task.target}/%n.class") }.
|
|
344
|
+
sources.map { |src| File.utime(time, time, src); src.pathmap("#{compile_task.target}/thepackage/%n.class") }.
|
|
341
345
|
each { |kls| write kls ; File.utime(time, time, kls) }
|
|
342
346
|
lambda { compile_task.from(sources).with(jars).invoke }.should_not run_task('foo:compile')
|
|
343
347
|
end
|
|
@@ -434,7 +438,7 @@ describe Project, '#compile' do
|
|
|
434
438
|
lambda { project('foo').compile.invoke }.should run_task('foo:bar:compile')
|
|
435
439
|
end
|
|
436
440
|
|
|
437
|
-
it '
|
|
441
|
+
it 'should be a local task' do
|
|
438
442
|
write 'bar/src/main/java/Test.java', 'class Test {}'
|
|
439
443
|
define('foo') { define 'bar' }
|
|
440
444
|
lambda do
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with this
|
|
3
|
+
# work for additional information regarding copyright ownership. The ASF
|
|
4
|
+
# licenses this file to you under the Apache License, Version 2.0 (the
|
|
5
|
+
# "License"); you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
12
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
13
|
+
# License for the specific language governing permissions and limitations under
|
|
14
|
+
# the License.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
require File.join(File.dirname(__FILE__), '../spec_helpers')
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
describe Buildr::Generate do
|
|
21
|
+
|
|
22
|
+
describe 'Generated buildfile' do
|
|
23
|
+
it 'should be a legal buildfile' do
|
|
24
|
+
File.open('buildfile', 'w') { |file| file.write Generate.from_directory(true).join("\n") }
|
|
25
|
+
lambda { Buildr.application.run }.should_not raise_error
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it 'should not contain NEXT_VERSION because it was removed in buildr 1.3.3' do
|
|
29
|
+
buildfile = Generate.from_directory(true)
|
|
30
|
+
buildfile.each { |line| line.should_not include('NEXT_VERSION')}
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
# the License.
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
require File.join(File.dirname(__FILE__), 'spec_helpers')
|
|
17
|
+
require File.join(File.dirname(__FILE__), '../spec_helpers')
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
describe Project do
|
|
@@ -644,6 +644,13 @@ describe Project, '#task' do
|
|
|
644
644
|
define('foo') { task('bar') }
|
|
645
645
|
project('foo').task('bar').name.should eql('foo:bar')
|
|
646
646
|
end
|
|
647
|
+
|
|
648
|
+
it 'should ignore namespace if starting with color' do
|
|
649
|
+
define 'foo' do
|
|
650
|
+
task(':bar').name.should == 'bar'
|
|
651
|
+
end
|
|
652
|
+
Rake::Task.task_defined?('bar').should be_true
|
|
653
|
+
end
|
|
647
654
|
|
|
648
655
|
it 'should accept single dependency' do
|
|
649
656
|
define('foo') { task('bar'=>'baz') }
|
|
@@ -739,13 +746,9 @@ end
|
|
|
739
746
|
|
|
740
747
|
|
|
741
748
|
describe Rake::Task, 'buildr:initialize' do
|
|
742
|
-
it 'should be ready to run as the first task' do
|
|
743
|
-
Buildr.application.top_level_tasks.first.should eql('buildr:initialize')
|
|
744
|
-
end
|
|
745
|
-
|
|
746
749
|
it 'should evaluate all project definitions' do
|
|
747
750
|
defined = false
|
|
748
751
|
Buildr.define('foo') { defined = true }
|
|
749
752
|
lambda { task('buildr:initialize').invoke }.should change { defined }.to(true)
|
|
750
753
|
end
|
|
751
|
-
end
|
|
754
|
+
end
|
|
@@ -14,7 +14,17 @@
|
|
|
14
14
|
# the License.
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
require File.join(File.dirname(__FILE__), 'spec_helpers')
|
|
17
|
+
require File.join(File.dirname(__FILE__), '../spec_helpers')
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
module TestHelper
|
|
21
|
+
def touch_last_successful_test_run(test_task, timestamp = Time.now)
|
|
22
|
+
test_task.instance_eval do
|
|
23
|
+
record_successful_run
|
|
24
|
+
File.utime(timestamp, timestamp, last_successful_run_file)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
18
28
|
|
|
19
29
|
|
|
20
30
|
describe Buildr::TestTask do
|
|
@@ -188,6 +198,12 @@ describe Buildr::TestTask do
|
|
|
188
198
|
project('foo').test.dependencies.should include(project('foo').compile.target)
|
|
189
199
|
end
|
|
190
200
|
|
|
201
|
+
it 'should include the main compile target in its dependencies, even when using non standard directories' do
|
|
202
|
+
write 'src/java/Nothing.java', 'class Nothing {}'
|
|
203
|
+
define('foo') { compile path_to('src/java') }
|
|
204
|
+
project('foo').test.dependencies.should include(project('foo').compile.target)
|
|
205
|
+
end
|
|
206
|
+
|
|
191
207
|
it 'should include the main resources target in its dependencies' do
|
|
192
208
|
write 'src/main/resources/config.xml'
|
|
193
209
|
define('foo').test.dependencies.should include(project('foo').resources.target)
|
|
@@ -203,6 +219,12 @@ describe Buildr::TestTask do
|
|
|
203
219
|
project('foo').test.dependencies.should include(project('foo').test.compile.target)
|
|
204
220
|
end
|
|
205
221
|
|
|
222
|
+
it 'should include the test compile target in its dependencies, even when using non standard directories' do
|
|
223
|
+
write 'src/test/Test.java', 'class Test {}'
|
|
224
|
+
define('foo') { test.compile path_to('src/test') }
|
|
225
|
+
project('foo').test.dependencies.should include(project('foo').test.compile.target)
|
|
226
|
+
end
|
|
227
|
+
|
|
206
228
|
it 'should add test compile target ahead of regular compile target' do
|
|
207
229
|
write 'src/main/java/Code.java'
|
|
208
230
|
write 'src/test/java/Test.java'
|
|
@@ -223,6 +245,10 @@ describe Buildr::TestTask do
|
|
|
223
245
|
depends = project('foo').test.dependencies
|
|
224
246
|
depends.index(project('foo').test.resources.target).should < depends.index(project('foo').resources.target)
|
|
225
247
|
end
|
|
248
|
+
|
|
249
|
+
it 'should not have a last successful run timestamp before the tests are run' do
|
|
250
|
+
test_task.timestamp.should == Rake::EARLY
|
|
251
|
+
end
|
|
226
252
|
|
|
227
253
|
it 'should clean after itself (test files)' do
|
|
228
254
|
define('foo') { test.compile.using(:javac) }
|
|
@@ -244,7 +270,7 @@ describe Buildr::TestTask, 'with no tests' do
|
|
|
244
270
|
end
|
|
245
271
|
|
|
246
272
|
it 'should report no failed tests' do
|
|
247
|
-
lambda { verbose(true) { define('foo').test.invoke } }.should_not
|
|
273
|
+
lambda { verbose(true) { define('foo').test.invoke } }.should_not show_error(/fail/i)
|
|
248
274
|
end
|
|
249
275
|
|
|
250
276
|
it 'should return no failed tests' do
|
|
@@ -284,7 +310,7 @@ describe Buildr::TestTask, 'with passing tests' do
|
|
|
284
310
|
end
|
|
285
311
|
|
|
286
312
|
it 'should report no failed tests' do
|
|
287
|
-
lambda { verbose(true) { test_task.invoke } }.should_not
|
|
313
|
+
lambda { verbose(true) { test_task.invoke } }.should_not show_error(/fail/i)
|
|
288
314
|
end
|
|
289
315
|
|
|
290
316
|
it 'should return passed tests' do
|
|
@@ -300,10 +326,17 @@ describe Buildr::TestTask, 'with passing tests' do
|
|
|
300
326
|
it 'should execute teardown task' do
|
|
301
327
|
lambda { test_task.invoke }.should run_task('foo:test:teardown')
|
|
302
328
|
end
|
|
329
|
+
|
|
330
|
+
it 'should update the last successful run timestamp' do
|
|
331
|
+
before = Time.now ; test_task.invoke ; after = Time.now
|
|
332
|
+
(before-1..after+1).should include(test_task.timestamp)
|
|
333
|
+
end
|
|
303
334
|
end
|
|
304
335
|
|
|
305
336
|
|
|
306
337
|
describe Buildr::TestTask, 'with failed test' do
|
|
338
|
+
include TestHelper
|
|
339
|
+
|
|
307
340
|
def test_task
|
|
308
341
|
@test_task ||= begin
|
|
309
342
|
define 'foo' do
|
|
@@ -322,7 +355,7 @@ describe Buildr::TestTask, 'with failed test' do
|
|
|
322
355
|
end
|
|
323
356
|
|
|
324
357
|
it 'should report failed tests' do
|
|
325
|
-
lambda { verbose(true) { test_task.invoke rescue nil } }.should
|
|
358
|
+
lambda { verbose(true) { test_task.invoke rescue nil } }.should show_error(/FailingTest/)
|
|
326
359
|
end
|
|
327
360
|
|
|
328
361
|
it 'should return failed tests' do
|
|
@@ -342,7 +375,7 @@ describe Buildr::TestTask, 'with failed test' do
|
|
|
342
375
|
|
|
343
376
|
it 'should report failed tests even if fail_on_failure is false' do
|
|
344
377
|
test_task.using(:fail_on_failure=>false)
|
|
345
|
-
lambda { verbose(true) { test_task.invoke } }.should
|
|
378
|
+
lambda { verbose(true) { test_task.invoke } }.should show_error(/FailingTest/)
|
|
346
379
|
end
|
|
347
380
|
|
|
348
381
|
it 'should return failed tests even if fail_on_failure is false' do
|
|
@@ -353,6 +386,13 @@ describe Buildr::TestTask, 'with failed test' do
|
|
|
353
386
|
it 'should execute teardown task' do
|
|
354
387
|
lambda { test_task.invoke rescue nil }.should run_task('foo:test:teardown')
|
|
355
388
|
end
|
|
389
|
+
|
|
390
|
+
it 'should not update the last successful run timestamp' do
|
|
391
|
+
a_second_ago = Time.now - 1
|
|
392
|
+
touch_last_successful_test_run test_task, a_second_ago
|
|
393
|
+
test_task.invoke rescue nil
|
|
394
|
+
test_task.timestamp.should <= a_second_ago
|
|
395
|
+
end
|
|
356
396
|
end
|
|
357
397
|
|
|
358
398
|
|
|
@@ -401,7 +441,7 @@ describe Buildr::Project, '#test' do
|
|
|
401
441
|
end
|
|
402
442
|
end
|
|
403
443
|
|
|
404
|
-
it 'should clone options from parent project' do
|
|
444
|
+
it 'should clone options from parent project when using #using' do
|
|
405
445
|
define 'foo' do
|
|
406
446
|
define 'bar' do
|
|
407
447
|
test.using :fail_on_failure=>false, :fork=>:each, :properties=>{ :foo=>'bar' }, :environment=>{ 'config'=>'config.yaml' }
|
|
@@ -409,9 +449,57 @@ describe Buildr::Project, '#test' do
|
|
|
409
449
|
end.invoke
|
|
410
450
|
test.options[:fail_on_failure].should be_true
|
|
411
451
|
test.options[:fork].should == :once
|
|
412
|
-
test.options[:properties].should
|
|
413
|
-
test.options[:environment].should
|
|
452
|
+
test.options[:properties].should == {}
|
|
453
|
+
test.options[:environment].should == {}
|
|
454
|
+
end
|
|
455
|
+
end
|
|
456
|
+
|
|
457
|
+
it 'should clone options from parent project when using #options' do
|
|
458
|
+
define 'foo' do
|
|
459
|
+
define 'bar' do
|
|
460
|
+
test.options[:fail_on_failure] = false
|
|
461
|
+
test.options[:fork] = :each
|
|
462
|
+
test.options[:properties][:foo] = 'bar'
|
|
463
|
+
test.options[:environment]['config'] = 'config.yaml'
|
|
464
|
+
test.using :junit
|
|
465
|
+
end.invoke
|
|
466
|
+
test.options[:fail_on_failure].should be_true
|
|
467
|
+
test.options[:fork].should == :once
|
|
468
|
+
test.options[:properties].should == {}
|
|
469
|
+
test.options[:environment].should == {}
|
|
470
|
+
end
|
|
471
|
+
end
|
|
472
|
+
|
|
473
|
+
it 'should accept to set a test property in the top project' do
|
|
474
|
+
define 'foo' do
|
|
475
|
+
test.options[:properties][:foo] = 'bar'
|
|
414
476
|
end
|
|
477
|
+
project('foo').test.options[:properties][:foo].should == 'bar'
|
|
478
|
+
end
|
|
479
|
+
|
|
480
|
+
it 'should accept to set a test property in a subproject' do
|
|
481
|
+
define 'foo' do
|
|
482
|
+
define 'bar' do
|
|
483
|
+
test.options[:properties][:bar] = 'baz'
|
|
484
|
+
end
|
|
485
|
+
end
|
|
486
|
+
project('foo:bar').test.options[:properties][:bar].should == 'baz'
|
|
487
|
+
end
|
|
488
|
+
|
|
489
|
+
it 'should not change options of unrelated projects when using #options' do
|
|
490
|
+
define 'foo' do
|
|
491
|
+
test.options[:properties][:foo] = 'bar'
|
|
492
|
+
end
|
|
493
|
+
define 'bar' do
|
|
494
|
+
test.options[:properties].should == {}
|
|
495
|
+
end
|
|
496
|
+
end
|
|
497
|
+
|
|
498
|
+
it "should run from project's build task" do
|
|
499
|
+
write 'src/main/java/Foo.java'
|
|
500
|
+
write 'src/test/java/FooTest.java'
|
|
501
|
+
define('foo')
|
|
502
|
+
lambda { task('foo:build').invoke }.should run_task('foo:test')
|
|
415
503
|
end
|
|
416
504
|
end
|
|
417
505
|
|
|
@@ -471,7 +559,7 @@ describe Buildr::Project, '#test.compile' do
|
|
|
471
559
|
end
|
|
472
560
|
|
|
473
561
|
|
|
474
|
-
describe Buildr::Project, 'test
|
|
562
|
+
describe Buildr::Project, '#test.resources' do
|
|
475
563
|
it 'should ignore resources unless they exist' do
|
|
476
564
|
define('foo').test.resources.sources.should be_empty
|
|
477
565
|
project('foo').test.resources.target.should be_nil
|
|
@@ -501,6 +589,99 @@ describe Buildr::Project, 'test:resources' do
|
|
|
501
589
|
end
|
|
502
590
|
|
|
503
591
|
|
|
592
|
+
describe Buildr::TestTask, '#invoke' do
|
|
593
|
+
include TestHelper
|
|
594
|
+
|
|
595
|
+
def test_task
|
|
596
|
+
@test_task ||= define('foo') {
|
|
597
|
+
test.using(:junit)
|
|
598
|
+
test.instance_eval do
|
|
599
|
+
@framework.stub!(:tests).and_return(['PassingTest'])
|
|
600
|
+
@framework.stub!(:run).and_return(['PassingTest'])
|
|
601
|
+
end
|
|
602
|
+
}.test
|
|
603
|
+
end
|
|
604
|
+
|
|
605
|
+
it 'should require dependencies to exist' do
|
|
606
|
+
lambda { test_task.with('no-such.jar').invoke }.should \
|
|
607
|
+
raise_error(RuntimeError, /Don't know how to build/)
|
|
608
|
+
end
|
|
609
|
+
|
|
610
|
+
it 'should run all dependencies as prerequisites' do
|
|
611
|
+
file(File.expand_path('no-such.jar')) { task('prereq').invoke }
|
|
612
|
+
lambda { test_task.with('no-such.jar').invoke }.should run_tasks(['prereq', 'foo:test'])
|
|
613
|
+
end
|
|
614
|
+
|
|
615
|
+
it 'should run tests if they have never run' do
|
|
616
|
+
lambda { test_task.invoke }.should run_task('foo:test')
|
|
617
|
+
end
|
|
618
|
+
|
|
619
|
+
it 'should not run tests if test option is off' do
|
|
620
|
+
Buildr.options.test = false
|
|
621
|
+
lambda { test_task.invoke }.should_not run_task('foo:test')
|
|
622
|
+
end
|
|
623
|
+
|
|
624
|
+
describe 'when there was a successful test run already' do
|
|
625
|
+
before do
|
|
626
|
+
@a_second_ago = Time.now - 1
|
|
627
|
+
src = ['main/java/Foo.java', 'main/resources/config.xml', 'test/java/FooTest.java', 'test/resources/config-test.xml'].map { |f| File.join('src', f) }
|
|
628
|
+
target = ['classes/Foo.class', 'resources/config.xml', 'test/classes/FooTest.class', 'test/resources/config-test.xml'].map { |f| File.join('target', f) }
|
|
629
|
+
files = ['buildfile'] + src + target
|
|
630
|
+
files.each { |file| write file }
|
|
631
|
+
(files + files.map { |file| file.pathmap('%d') }).each { |file| File.utime(@a_second_ago, @a_second_ago, file) }
|
|
632
|
+
touch_last_successful_test_run test_task, @a_second_ago
|
|
633
|
+
end
|
|
634
|
+
|
|
635
|
+
it 'should not run tests if nothing changed' do
|
|
636
|
+
lambda { test_task.invoke }.should_not run_task('foo:test')
|
|
637
|
+
end
|
|
638
|
+
|
|
639
|
+
it 'should run tests if options.test is :all' do
|
|
640
|
+
Buildr.options.test = :all
|
|
641
|
+
lambda { test_task.invoke }.should run_task('foo:test')
|
|
642
|
+
end
|
|
643
|
+
|
|
644
|
+
it 'should run tests if main compile target changed' do
|
|
645
|
+
touch project('foo').compile.target.to_s
|
|
646
|
+
lambda { test_task.invoke }.should run_task('foo:test')
|
|
647
|
+
end
|
|
648
|
+
|
|
649
|
+
it 'should run tests if test compile target changed' do
|
|
650
|
+
touch test_task.compile.target.to_s
|
|
651
|
+
lambda { test_task.invoke }.should run_task('foo:test')
|
|
652
|
+
end
|
|
653
|
+
|
|
654
|
+
it 'should run tests if main resources changed' do
|
|
655
|
+
touch project('foo').resources.target.to_s
|
|
656
|
+
lambda { test_task.invoke }.should run_task('foo:test')
|
|
657
|
+
end
|
|
658
|
+
|
|
659
|
+
it 'should run tests if test resources changed' do
|
|
660
|
+
touch test_task.resources.target.to_s
|
|
661
|
+
lambda { test_task.invoke }.should run_task('foo:test')
|
|
662
|
+
end
|
|
663
|
+
|
|
664
|
+
it 'should run tests if compile-dependent project changed' do
|
|
665
|
+
write 'bar/src/main/java/Bar.java', 'public class Bar {}'
|
|
666
|
+
define('bar', :version=>'1.0', :base_dir=>'bar') { package :jar }
|
|
667
|
+
project('foo').compile.with project('bar')
|
|
668
|
+
lambda { test_task.invoke }.should run_task('foo:test')
|
|
669
|
+
end
|
|
670
|
+
|
|
671
|
+
it 'should run tests if test-dependent project changed' do
|
|
672
|
+
write 'bar/src/main/java/Bar.java', 'public class Bar {}'
|
|
673
|
+
define('bar', :version=>'1.0', :base_dir=>'bar') { package :jar }
|
|
674
|
+
test_task.with project('bar')
|
|
675
|
+
lambda { test_task.invoke }.should run_task('foo:test')
|
|
676
|
+
end
|
|
677
|
+
|
|
678
|
+
it 'should run tests if buildfile changed' do
|
|
679
|
+
touch 'buildfile'
|
|
680
|
+
lambda { test_task.invoke }.should run_task('foo:test')
|
|
681
|
+
end
|
|
682
|
+
end
|
|
683
|
+
end
|
|
684
|
+
|
|
504
685
|
describe Rake::Task, 'test' do
|
|
505
686
|
it 'should be recursive' do
|
|
506
687
|
define('foo') { define 'bar' }
|
|
@@ -519,7 +700,7 @@ describe Rake::Task, 'test' do
|
|
|
519
700
|
it 'should stop at first failure' do
|
|
520
701
|
define('foo') { test { fail } }
|
|
521
702
|
define('bar') { test { fail } }
|
|
522
|
-
lambda { task('test').invoke rescue nil }.should run_tasks('
|
|
703
|
+
lambda { task('test').invoke rescue nil }.should run_tasks('foo:test').but_not('bar:test')
|
|
523
704
|
end
|
|
524
705
|
|
|
525
706
|
it 'should ignore failure if options.test is :all' do
|
|
@@ -567,6 +748,8 @@ end
|
|
|
567
748
|
|
|
568
749
|
|
|
569
750
|
describe 'test rule' do
|
|
751
|
+
include TestHelper
|
|
752
|
+
|
|
570
753
|
it 'should execute test task on local project' do
|
|
571
754
|
define('foo') { define 'bar' }
|
|
572
755
|
lambda { task('test:something').invoke }.should run_task('foo:test')
|
|
@@ -621,22 +804,31 @@ describe 'test rule' do
|
|
|
621
804
|
it 'should execute only the named tests' do
|
|
622
805
|
write 'src/test/java/TestSomething.java',
|
|
623
806
|
'public class TestSomething extends junit.framework.TestCase { public void testNothing() {} }'
|
|
624
|
-
write 'src/test/java/TestFails.java',
|
|
807
|
+
write 'src/test/java/TestFails.java',
|
|
808
|
+
'public class TestFails extends junit.framework.TestCase { public void testFailure() { fail(); } }'
|
|
625
809
|
define 'foo'
|
|
626
810
|
task('test:Something').invoke
|
|
627
811
|
end
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
812
|
+
|
|
813
|
+
it 'should execute the named tests even if the test task is not needed' do
|
|
814
|
+
define 'foo' do
|
|
815
|
+
test.using(:junit)
|
|
816
|
+
test.instance_eval { @framework.stub!(:tests).and_return(['something', 'nothing']) }
|
|
817
|
+
end
|
|
818
|
+
touch_last_successful_test_run project('foo').test
|
|
819
|
+
task('test:something').invoke
|
|
820
|
+
project('foo').test.tests.should include('something')
|
|
635
821
|
end
|
|
636
|
-
|
|
637
|
-
it 'should not
|
|
638
|
-
|
|
639
|
-
|
|
822
|
+
|
|
823
|
+
it 'should not update the last successful test run timestamp' do
|
|
824
|
+
define 'foo' do
|
|
825
|
+
test.using(:junit)
|
|
826
|
+
test.instance_eval { @framework.stub!(:tests).and_return(['something', 'nothing']) }
|
|
827
|
+
end
|
|
828
|
+
a_second_ago = Time.now - 1
|
|
829
|
+
touch_last_successful_test_run project('foo').test, a_second_ago
|
|
830
|
+
task('test:something').invoke
|
|
831
|
+
project('foo').test.timestamp.should <= a_second_ago
|
|
640
832
|
end
|
|
641
833
|
end
|
|
642
834
|
|
|
@@ -668,7 +860,7 @@ describe Buildr::Options, 'test' do
|
|
|
668
860
|
|
|
669
861
|
it 'should be true and warn for any other value' do
|
|
670
862
|
ENV['TEST'] = 'funky'
|
|
671
|
-
lambda { Buildr.options.test.should be(true) }.should
|
|
863
|
+
lambda { Buildr.options.test.should be(true) }.should show_warning(/expecting the environment variable/i)
|
|
672
864
|
end
|
|
673
865
|
end
|
|
674
866
|
|
|
@@ -763,13 +955,13 @@ describe Rake::Task, 'integration' do
|
|
|
763
955
|
it 'should run setup task before any project integration tests' do
|
|
764
956
|
define('foo') { test.using :integration }
|
|
765
957
|
define('bar') { test.using :integration }
|
|
766
|
-
lambda { task('integration').invoke }.should run_tasks([integration.setup, 'bar:test', 'foo:test'])
|
|
958
|
+
lambda { task('integration').invoke }.should run_tasks([integration.setup, 'bar:test'], [integration.setup, 'foo:test'])
|
|
767
959
|
end
|
|
768
960
|
|
|
769
961
|
it 'should run teardown task after all project integrations tests' do
|
|
770
962
|
define('foo') { test.using :integration }
|
|
771
963
|
define('bar') { test.using :integration }
|
|
772
|
-
lambda { task('integration').invoke }.should run_tasks(['bar:test', 'foo:test', integration.teardown])
|
|
964
|
+
lambda { task('integration').invoke }.should run_tasks(['bar:test', integration.teardown], ['foo:test', integration.teardown])
|
|
773
965
|
end
|
|
774
966
|
|
|
775
967
|
it 'should run test cases marked for integration' do
|
|
@@ -819,7 +1011,7 @@ describe Rake::Task, 'integration' do
|
|
|
819
1011
|
define('bar') { test.using :integration=>false }
|
|
820
1012
|
end
|
|
821
1013
|
lambda { task('package').invoke }.should run_tasks(['foo:package', 'foo:test'],
|
|
822
|
-
['foo:bar:
|
|
1014
|
+
['foo:bar:test', 'foo:bar:package'])
|
|
823
1015
|
end
|
|
824
1016
|
|
|
825
1017
|
it 'should not execute by local package task if test=no' do
|
|
@@ -888,10 +1080,12 @@ describe 'integration rule' do
|
|
|
888
1080
|
project('foo').test.tests.should_not include('baz')
|
|
889
1081
|
end
|
|
890
1082
|
|
|
891
|
-
it 'should execute only the named
|
|
1083
|
+
it 'should execute only the named tests' do
|
|
892
1084
|
write 'src/test/java/TestSomething.java',
|
|
893
1085
|
'public class TestSomething extends junit.framework.TestCase { public void testNothing() {} }'
|
|
894
|
-
write 'src/test/java/TestFails.java',
|
|
1086
|
+
write 'src/test/java/TestFails.java',
|
|
1087
|
+
'public class TestFails extends junit.framework.TestCase { public void testFailure() { fail(); } }'
|
|
1088
|
+
define('foo') { test.using :junit, :integration }
|
|
895
1089
|
task('integration:Something').invoke
|
|
896
1090
|
end
|
|
897
1091
|
end
|