buildr 1.4.6 → 1.4.7.pre2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. data/CHANGELOG +59 -0
  2. data/Rakefile +1 -1
  3. data/addon/buildr/antlr.rb +0 -4
  4. data/addon/buildr/bnd.rb +3 -1
  5. data/addon/buildr/checkstyle.rake +201 -0
  6. data/addon/buildr/cobertura.rb +0 -1
  7. data/addon/buildr/drb.rb +0 -2
  8. data/addon/buildr/emma.rb +0 -1
  9. data/addon/buildr/findbugs.rake +227 -0
  10. data/addon/buildr/hibernate.rb +0 -4
  11. data/addon/buildr/javacc.rb +0 -4
  12. data/addon/buildr/javancss.rake +155 -0
  13. data/addon/buildr/jdepend.rb +138 -24
  14. data/addon/buildr/jetty.rb +0 -5
  15. data/addon/buildr/jibx.rb +85 -86
  16. data/addon/buildr/openjpa.rb +0 -4
  17. data/addon/buildr/pmd.rake +164 -0
  18. data/addon/buildr/protobuf.rb +0 -1
  19. data/addon/buildr/xmlbeans.rb +0 -5
  20. data/buildr.gemspec +19 -8
  21. data/doc/_layouts/default.html +1 -0
  22. data/doc/contributing.textile +11 -2
  23. data/doc/download.textile +17 -5
  24. data/doc/index.textile +21 -46
  25. data/doc/installing.textile +18 -8
  26. data/doc/languages.textile +0 -38
  27. data/doc/more_stuff.textile +168 -12
  28. data/doc/packaging.textile +10 -0
  29. data/doc/settings_profiles.textile +2 -2
  30. data/lib/buildr.rb +67 -4
  31. data/lib/buildr/clojure.rb +0 -2
  32. data/lib/buildr/core/application.rb +23 -32
  33. data/lib/buildr/core/build.rb +0 -7
  34. data/lib/buildr/core/cc.rb +0 -5
  35. data/lib/buildr/core/checks.rb +0 -4
  36. data/lib/buildr/core/common.rb +0 -5
  37. data/lib/buildr/core/compile.rb +5 -10
  38. data/lib/buildr/core/environment.rb +0 -1
  39. data/lib/buildr/core/filter.rb +0 -5
  40. data/lib/buildr/core/generate.rb +0 -4
  41. data/lib/buildr/core/help.rb +1 -6
  42. data/lib/buildr/core/linux.rb +0 -1
  43. data/lib/buildr/core/osx.rb +0 -1
  44. data/lib/buildr/core/project.rb +0 -4
  45. data/lib/buildr/core/run.rb +0 -4
  46. data/lib/buildr/core/shell.rb +0 -5
  47. data/lib/buildr/core/test.rb +0 -6
  48. data/lib/buildr/core/transports.rb +4 -6
  49. data/lib/buildr/core/util.rb +0 -63
  50. data/lib/buildr/groovy/doc.rb +0 -3
  51. data/lib/buildr/groovy/shell.rb +0 -2
  52. data/lib/buildr/ide/eclipse.rb +0 -9
  53. data/lib/buildr/ide/eclipse/java.rb +0 -4
  54. data/lib/buildr/ide/eclipse/plugin.rb +0 -4
  55. data/lib/buildr/ide/eclipse/scala.rb +0 -4
  56. data/lib/buildr/ide/idea.rb +100 -51
  57. data/lib/buildr/java/ant.rb +0 -3
  58. data/lib/buildr/java/bdd.rb +1 -119
  59. data/lib/buildr/java/cobertura.rb +16 -10
  60. data/lib/buildr/java/commands.rb +33 -7
  61. data/lib/buildr/java/compiler.rb +0 -7
  62. data/lib/buildr/java/deprecated.rb +0 -4
  63. data/lib/buildr/java/doc.rb +0 -2
  64. data/lib/buildr/java/emma.rb +0 -4
  65. data/lib/buildr/java/jruby.rb +0 -2
  66. data/lib/buildr/java/packaging.rb +0 -4
  67. data/lib/buildr/java/pom.rb +19 -12
  68. data/lib/buildr/java/test_result.rb +0 -5
  69. data/lib/buildr/java/tests.rb +68 -6
  70. data/lib/buildr/packaging/archive.rb +0 -1
  71. data/lib/buildr/packaging/artifact.rb +19 -16
  72. data/lib/buildr/packaging/artifact_namespace.rb +51 -24
  73. data/lib/buildr/packaging/artifact_search.rb +1 -2
  74. data/lib/buildr/packaging/gems.rb +1 -13
  75. data/lib/buildr/packaging/package.rb +0 -6
  76. data/lib/buildr/packaging/tar.rb +2 -4
  77. data/lib/buildr/packaging/zip.rb +0 -1
  78. data/lib/buildr/packaging/ziptask.rb +0 -4
  79. data/lib/buildr/run.rb +0 -1
  80. data/lib/buildr/scala/bdd.rb +129 -11
  81. data/lib/buildr/scala/compiler.rb +53 -6
  82. data/lib/buildr/scala/doc.rb +6 -4
  83. data/lib/buildr/scala/org/apache/buildr/Specs2Runner.java +38 -0
  84. data/lib/buildr/scala/shell.rb +0 -4
  85. data/lib/buildr/scala/tests.rb +15 -6
  86. data/lib/buildr/shell.rb +0 -1
  87. data/lib/buildr/version.rb +1 -1
  88. data/rakelib/all-in-one.rake +20 -11
  89. data/rakelib/checks.rake +0 -31
  90. data/rakelib/doc.rake +86 -100
  91. data/rakelib/release.rake +1 -1
  92. data/rakelib/rspec.rake +1 -3
  93. data/rakelib/stage.rake +2 -9
  94. data/spec/addon/bnd_spec.rb +2 -2
  95. data/spec/addon/jaxb_xjc_spec.rb +5 -0
  96. data/spec/core/application_spec.rb +10 -63
  97. data/spec/core/cc_spec.rb +0 -1
  98. data/spec/core/compile_spec.rb +11 -0
  99. data/spec/ide/idea_spec.rb +60 -0
  100. data/spec/java/bdd_spec.rb +8 -218
  101. data/spec/java/compiler_spec.rb +11 -8
  102. data/spec/java/tests_spec.rb +185 -0
  103. data/spec/packaging/artifact_namespace_spec.rb +15 -0
  104. data/spec/packaging/artifact_spec.rb +25 -0
  105. data/spec/sandbox.rb +3 -1
  106. data/spec/scala/bdd_spec.rb +111 -8
  107. data/spec/scala/tests_spec.rb +5 -1
  108. data/spec/spec_helpers.rb +3 -3
  109. metadata +377 -465
  110. data/lib/buildr/core.rb +0 -34
  111. data/lib/buildr/ide.rb +0 -19
  112. data/lib/buildr/java.rb +0 -25
  113. data/lib/buildr/java/jtestr_result.rb +0 -331
  114. data/lib/buildr/java/jtestr_runner.rb.erb +0 -116
  115. data/lib/buildr/packaging.rb +0 -25
  116. data/rakelib/setup.rake +0 -68
@@ -68,15 +68,18 @@ describe 'javac compiler' do
68
68
  end
69
69
  end
70
70
 
71
- it 'should include classpath dependencies' do
72
- write 'src/dependency/Dependency.java', 'class Dependency {}'
73
- define 'dependency', :version=>'1.0' do
74
- compile.from('src/dependency').into('target/dependency')
75
- package(:jar)
71
+ # Doesn't work under jdk1.5 - caused in one of the commits 1167678, 1170604, 1170605, 1180125
72
+ if Java.java.lang.System.getProperty("java.runtime.version") >= "1.6"
73
+ it 'should include classpath dependencies' do
74
+ write 'src/dependency/Dependency.java', 'class Dependency {}'
75
+ define 'dependency', :version=>'1.0' do
76
+ compile.from('src/dependency').into('target/dependency')
77
+ package(:jar)
78
+ end
79
+ write 'src/test/DependencyTest.java', 'class DependencyTest { Dependency _var; }'
80
+ define('foo').compile.from('src/test').with(project('dependency')).invoke
81
+ file('target/classes/DependencyTest.class').should exist
76
82
  end
77
- write 'src/test/DependencyTest.java', 'class DependencyTest { Dependency _var; }'
78
- define('foo').compile.from('src/test').with(project('dependency')).invoke
79
- file('target/classes/DependencyTest.class').should exist
80
83
  end
81
84
 
82
85
  it 'should include tools.jar dependency' do
@@ -494,4 +494,189 @@ describe Buildr::TestNG do
494
494
  define('foo') { test.using(:testng) }
495
495
  lambda { project('foo').test.invoke }.should change { File.exist?('reports/testng/foo/index.html') }.to(true)
496
496
  end
497
+
498
+ it 'should include classes using TestNG annotations marked with a specific group' do
499
+ write 'src/test/java/com/example/AnnotatedClass.java', <<-JAVA
500
+ package com.example;
501
+ @org.testng.annotations.Test(groups={"included"})
502
+ public class AnnotatedClass { }
503
+ JAVA
504
+ write 'src/test/java/com/example/AnnotatedMethod.java', <<-JAVA
505
+ package com.example;
506
+ public class AnnotatedMethod {
507
+ @org.testng.annotations.Test
508
+ public void annotated() {
509
+ org.testng.AssertJUnit.assertTrue(false);
510
+ }
511
+ }
512
+ JAVA
513
+ define('foo').test.using :testng, :groups=>['included']
514
+ lambda { project('foo').test.invoke }.should_not raise_error
515
+ end
516
+
517
+ it 'should exclude classes using TestNG annotations marked with a specific group' do
518
+ write 'src/test/java/com/example/AnnotatedClass.java', <<-JAVA
519
+ package com.example;
520
+ @org.testng.annotations.Test(groups={"excluded"})
521
+ public class AnnotatedClass {
522
+ public void annotated() {
523
+ org.testng.AssertJUnit.assertTrue(false);
524
+ }
525
+ }
526
+ JAVA
527
+ write 'src/test/java/com/example/AnnotatedMethod.java', <<-JAVA
528
+ package com.example;
529
+ public class AnnotatedMethod {
530
+ @org.testng.annotations.Test(groups={"included"})
531
+ public void annotated() {}
532
+ }
533
+ JAVA
534
+ define('foo').test.using :testng, :excludegroups=>['excluded']
535
+ lambda { project('foo').test.invoke }.should_not raise_error
536
+ end
537
+ end
538
+
539
+ describe Buildr::MultiTest do
540
+ it 'should be selectable in project' do
541
+ define 'foo' do
542
+ test.using(:multitest, :frameworks => [])
543
+ test.framework.should eql(:multitest)
544
+ end
545
+ end
546
+
547
+ it 'should include dependencies of whichever test framework(s) are selected' do
548
+ define('foo') { test.using :multitest, :frameworks => [ Buildr::JUnit, Buildr::TestNG ] }
549
+ project('foo').test.compile.dependencies.should include(artifact("junit:junit:jar:#{JUnit.version}"))
550
+ project('foo').test.compile.dependencies.should include(artifact("org.testng:testng:jar:jdk15:#{TestNG.version}"))
551
+ project('foo').test.dependencies.should include(artifact("junit:junit:jar:#{JUnit.version}"))
552
+ project('foo').test.dependencies.should include(artifact("org.testng:testng:jar:jdk15:#{TestNG.version}"))
553
+ end
554
+
555
+ it 'should include classes of given test framework(s)' do
556
+ write 'src/test/java/com/example/JUnitTest.java', <<-JAVA
557
+ package com.example;
558
+ public class JUnitTest extends junit.framework.TestCase {
559
+ public void testNothing() { }
560
+ }
561
+ JAVA
562
+ write 'src/test/java/com/example/TestNGTest.java', <<-JAVA
563
+ package com.example;
564
+ @org.testng.annotations.Test
565
+ public class TestNGTest { }
566
+ JAVA
567
+ define('foo') { test.using :multitest, :frameworks => [ Buildr::JUnit, Buildr::TestNG ] }
568
+ project('foo').test.invoke
569
+ project('foo').test.tests.should include('com.example.JUnitTest', 'com.example.TestNGTest')
570
+ end
571
+
572
+ it 'should pass when test case passes' do
573
+ write 'src/test/java/PassingTest.java', <<-JAVA
574
+ public class PassingTest extends junit.framework.TestCase {
575
+ public void testNothing() {}
576
+ }
577
+ JAVA
578
+ define('foo') { test.using :multitest, :frameworks => [ Buildr::JUnit, Buildr::TestNG ] }
579
+ lambda { project('foo').test.invoke }.should_not raise_error
580
+ end
581
+
582
+ it 'should fail when test case fails' do
583
+ write 'src/test/java/FailingTest.java', <<-JAVA
584
+ public class FailingTest {
585
+ @org.testng.annotations.Test
586
+ public void testNothing() {
587
+ org.testng.AssertJUnit.assertTrue(false);
588
+ }
589
+ }
590
+ JAVA
591
+ define('foo') { test.using :multitest, :frameworks => [ Buildr::JUnit, Buildr::TestNG ] }
592
+ lambda { project('foo').test.invoke }.should raise_error(RuntimeError, /Tests failed/)
593
+ end
594
+
595
+ it 'should fail when multiple test case fail' do
596
+ write 'src/test/java/FailingTest1.java', <<-JAVA
597
+ public class FailingTest1 {
598
+ @org.testng.annotations.Test
599
+ public void testNothing() {
600
+ org.testng.AssertJUnit.assertTrue(false);
601
+ }
602
+ }
603
+ JAVA
604
+ write 'src/test/java/FailingTest2.java', <<-JAVA
605
+ public class FailingTest2 {
606
+ @org.testng.annotations.Test
607
+ public void testNothing() {
608
+ org.testng.AssertJUnit.assertTrue(false);
609
+ }
610
+ }
611
+ JAVA
612
+ define('foo') { test.using :multitest, :frameworks => [ Buildr::JUnit, Buildr::TestNG ] }
613
+ lambda { project('foo').test.invoke }.should raise_error(RuntimeError, /Tests failed/)
614
+ end
615
+
616
+ it 'should report failed test names' do
617
+ write 'src/test/java/FailingTest.java', <<-JAVA
618
+ public class FailingTest {
619
+ @org.testng.annotations.Test
620
+ public void testNothing() {
621
+ org.testng.AssertJUnit.assertTrue(false);
622
+ }
623
+ }
624
+ JAVA
625
+ define('foo') { test.using :multitest, :frameworks => [ Buildr::JUnit, Buildr::TestNG ] }
626
+ project('foo').test.invoke rescue nil
627
+ project('foo').test.failed_tests.should include('FailingTest')
628
+ end
629
+
630
+ it 'should generate reports' do
631
+ write 'src/test/java/PassingTest.java', <<-JAVA
632
+ public class PassingTest {
633
+ @org.testng.annotations.Test
634
+ public void testNothing() {}
635
+ }
636
+ JAVA
637
+ define('foo') { test.using :multitest, :frameworks => [ Buildr::JUnit, Buildr::TestNG ] }
638
+ lambda { project('foo').test.invoke }.should change {
639
+ p Dir['./**/*'].inspect
640
+ File.exist?('reports/multitest/foo/index.html') }.to(true)
641
+ end
642
+
643
+ it 'should include classes using TestNG annotations marked with a specific group' do
644
+ write 'src/test/java/com/example/AnnotatedClass.java', <<-JAVA
645
+ package com.example;
646
+ @org.testng.annotations.Test(groups={"included"})
647
+ public class AnnotatedClass { }
648
+ JAVA
649
+ write 'src/test/java/com/example/AnnotatedMethod.java', <<-JAVA
650
+ package com.example;
651
+ public class AnnotatedMethod {
652
+ @org.testng.annotations.Test
653
+ public void annotated() {
654
+ org.testng.AssertJUnit.assertTrue(false);
655
+ }
656
+ }
657
+ JAVA
658
+ define('foo') { test.using :multitest, :frameworks => [ Buildr::JUnit, Buildr::TestNG ], :groups=>['included'] }
659
+ lambda { project('foo').test.invoke }.should_not raise_error
660
+ end
661
+
662
+ it 'should exclude classes using TestNG annotations marked with a specific group' do
663
+ write 'src/test/java/com/example/AnnotatedClass.java', <<-JAVA
664
+ package com.example;
665
+ @org.testng.annotations.Test(groups={"excluded"})
666
+ public class AnnotatedClass {
667
+ public void annotated() {
668
+ org.testng.AssertJUnit.assertTrue(false);
669
+ }
670
+ }
671
+ JAVA
672
+ write 'src/test/java/com/example/AnnotatedMethod.java', <<-JAVA
673
+ package com.example;
674
+ public class AnnotatedMethod {
675
+ @org.testng.annotations.Test(groups={"included"})
676
+ public void annotated() {}
677
+ }
678
+ JAVA
679
+ define('foo') { test.using :multitest, :frameworks => [ Buildr::JUnit, Buildr::TestNG ], :excludegroups=>['excluded'] }
680
+ lambda { project('foo').test.invoke }.should_not raise_error
681
+ end
497
682
  end
@@ -162,6 +162,21 @@ describe Buildr::ArtifactNamespace do
162
162
  end
163
163
  end
164
164
 
165
+ it 'should accept an artifact spec with classifier' do
166
+ define 'one' do
167
+ artifact_ns.need 'a:b:c:d:1'
168
+ # referenced by spec
169
+ artifact_ns['a:b:c:d:'].should_not be_selected
170
+
171
+ # referenced by name
172
+ artifact_ns[:b].should_not be_selected
173
+ artifact_ns[:b].should be_satisfied_by('a:b:c:d:1')
174
+ artifact_ns[:b].should_not be_satisfied_by('a:b:c:d:2')
175
+ artifact_ns[:b].should_not be_satisfied_by('d:b:c:d:1')
176
+ artifact_ns[:b].version.should == '1'
177
+ end
178
+ end
179
+
165
180
  it 'should accept a requirement_spec' do
166
181
  define 'one' do
167
182
  artifact_ns.need 'thing -> a:b:c:2.1 -> ~>2.0'
@@ -690,6 +690,14 @@ describe Buildr, '#artifacts' do
690
690
  artifacts('c:test').first.should be_kind_of(String)
691
691
  end
692
692
 
693
+ it 'should accept any object responding to :to_spec' do
694
+ obj = Object.new
695
+ class << obj
696
+ def to_spec; "org.example:artifact:jar:1.1"; end
697
+ end
698
+ artifacts(obj).size.should be(1)
699
+ end
700
+
693
701
  it 'should accept project and return all its packaging tasks' do
694
702
  define 'foobar', :group=>'group', :version=>'1.0' do
695
703
  package :jar, :id=>'code'
@@ -1032,6 +1040,13 @@ describe Buildr, '#transitive' do
1032
1040
  <version>8.4</version>
1033
1041
  <scope>test</scope>
1034
1042
  </dependency>
1043
+ <dependency>
1044
+ <artifactId>jlib-optional</artifactId>
1045
+ <groupId>jlib</groupId>
1046
+ <version>1.4</version>
1047
+ <scope>runtime</scope>
1048
+ <optional>true</optional>
1049
+ </dependency>
1035
1050
  </dependencies>
1036
1051
  </project>
1037
1052
  XML
@@ -1110,6 +1125,16 @@ XML
1110
1125
  it 'should bring artifact and transitive depenencies' do
1111
1126
  transitive(@transitive).should eql(artifacts(@transitive, @complex, @simple - [@provided]))
1112
1127
  end
1128
+
1129
+ it 'should filter dependencies based on :scopes argument' do
1130
+ specs = [@complex, 'saxon:saxon-dom:jar:8.4']
1131
+ transitive(@complex, :scopes => [:runtime]).should eql(specs.map { |spec| artifact(spec) })
1132
+ end
1133
+
1134
+ it 'should filter dependencies based on :optional argument' do
1135
+ specs = [@complex, 'saxon:saxon-dom:jar:8.4', 'jlib:jlib-optional:jar:1.4']
1136
+ transitive(@complex, :scopes => [:runtime], :optional => true).should eql(specs.map { |spec| artifact(spec) })
1137
+ end
1113
1138
  end
1114
1139
 
1115
1140
  def modified?(old_mtime, spec)
@@ -42,7 +42,6 @@ artifacts(
42
42
  Buildr::JaxbXjc.dependencies,
43
43
  Buildr::Bnd.dependencies,
44
44
  Buildr::Scala::Scalac.dependencies,
45
- Buildr::Scala::Specs.dependencies,
46
45
  Buildr::Shell::BeanShell.artifact,
47
46
  Buildr::Clojure.dependencies
48
47
  ).each do |path|
@@ -54,6 +53,9 @@ mkpath ENV['HOME']
54
53
 
55
54
  # Make Scala.version resilient to sandbox reset
56
55
  module Buildr::Scala
56
+
57
+ remove_const(:DEFAULT_VERSION)
58
+
57
59
  DEFAULT_VERSION = SCALA_VERSION_FOR_SPECS
58
60
 
59
61
  class << self
@@ -13,12 +13,13 @@
13
13
  # License for the specific language governing permissions and limitations under
14
14
  # the License.
15
15
 
16
-
17
16
  require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers'))
18
17
 
18
+ if Java.java.lang.System.getProperty("java.runtime.version") >= "1.6"
19
+
19
20
  describe Buildr::Scala::Specs do
20
21
 
21
- it 'should be the default when tests in src/spec/scala' do
22
+ it 'should be the default when tests in src/spec/scala reference "org.specs"' do
22
23
  write 'src/spec/scala/com/example/MySpecs.scala', <<-SCALA
23
24
  package com.example
24
25
  object MySpecs extends org.specs.Specification {
@@ -46,12 +47,6 @@ describe Buildr::Scala::Specs do
46
47
  project('foo').test.dependencies.should include(*artifacts(Scala::Check.dependencies))
47
48
  end
48
49
 
49
- it 'should include JMock dependencies' do
50
- define('foo') { test.using(:scalatest) }
51
- project('foo').test.compile.dependencies.should include(*artifacts(JMock.dependencies))
52
- project('foo').test.dependencies.should include(*artifacts(JMock.dependencies))
53
- end
54
-
55
50
  it 'should include public objects extending org.specs.Specification' do
56
51
  write 'src/spec/scala/com/example/MySpecs.scala', <<-SCALA
57
52
  package com.example
@@ -117,3 +112,111 @@ describe Buildr::Scala::Specs do
117
112
  project('foo').test.failed_tests.should include('StringSpecs')
118
113
  end
119
114
  end
115
+
116
+ describe Buildr::Scala::Specs2 do
117
+
118
+ it 'should be the default when tests in src/spec/scala reference "org.specs2"' do
119
+ write 'src/spec/scala/com/example/MySpecs.scala', <<-SCALA
120
+ package com.example
121
+ object MySpecs extends org.specs2.Specification {
122
+ "it" should {
123
+ "add" in {
124
+ val sum = 1 + 1
125
+ sum mustEqual 2
126
+ }
127
+ }
128
+ }
129
+ SCALA
130
+ define 'foo'
131
+ project('foo').test.framework.should eql(:specs2)
132
+ end
133
+
134
+ it 'should include Specs2 dependencies' do
135
+ define('foo') { test.using(:specs2) }
136
+ project('foo').test.compile.dependencies.should include(*artifacts(Scala::Specs2.dependencies))
137
+ project('foo').test.dependencies.should include(*artifacts(Scala::Specs2.dependencies))
138
+ end
139
+
140
+ it 'should include ScalaCheck dependencies' do
141
+ define('foo') { test.using(:specs2) }
142
+ project('foo').test.compile.dependencies.should include(*artifacts(Scala::Check.dependencies))
143
+ project('foo').test.dependencies.should include(*artifacts(Scala::Check.dependencies))
144
+ end
145
+
146
+ it 'should include public objects extending org.specs2.mutable.Specification' do
147
+ write 'src/spec/scala/com/example/MySpecs.scala', <<-SCALA
148
+ package com.example
149
+ object MySpecs extends org.specs2.mutable.Specification {
150
+ "it" should {
151
+ "add" in {
152
+ val sum = 1 + 1
153
+ sum mustEqual 2
154
+ }
155
+ }
156
+ }
157
+ SCALA
158
+ define('foo').test.framework.should eql(:specs2)
159
+ project('foo').test.invoke
160
+ project('foo').test.tests.should include('com.example.MySpecs$')
161
+ end
162
+
163
+ it 'should include classes extending org.specs2.SpecificationWithJUnit' do
164
+ write 'src/spec/scala/com/example/MySpecs.scala', <<-SCALA
165
+ package com.example
166
+ import org.specs2.mutable._
167
+ class MySpecs extends org.specs2.SpecificationWithJUnit {
168
+ def is = {
169
+ "The 'Hello world' string should" ^
170
+ "contain 11 characters" ! {
171
+ "Hello world" must have size(11)
172
+ }^
173
+ "start with 'Hello'" ! {
174
+ "Hello world" must startWith("Hello")
175
+ }^
176
+ "end with 'world'" ! {
177
+ "Hello world" must endWith("world")
178
+ }
179
+ }
180
+ }
181
+ SCALA
182
+ define('foo')
183
+ project('foo').test.framework.should eql(:specs2)
184
+ project('foo').test.invoke
185
+ project('foo').test.tests.should include('com.example.MySpecs')
186
+ end
187
+
188
+ it 'should pass when spec passes' do
189
+ write 'src/spec/scala/PassingSpecs.scala', <<-SCALA
190
+ object PassingSpecs extends org.specs2.mutable.Specification {
191
+ "it" should {
192
+ "add" in {
193
+ val sum = 1 + 1
194
+ sum mustEqual 2
195
+ }
196
+ }
197
+ }
198
+ SCALA
199
+ lambda { define('foo').test.invoke }.should_not raise_error
200
+ end
201
+
202
+ it 'should fail when spec fails' do
203
+ write 'src/spec/scala/StringSpecs.scala', <<-SCALA
204
+ import org.specs2.mutable._
205
+
206
+ object StringSpecs extends Specification {
207
+ "empty string" should {
208
+ "have a zero length" in {
209
+ ("".length) mustEqual(1)
210
+ }
211
+ }
212
+ }
213
+ SCALA
214
+ define('foo')
215
+ project('foo').test.invoke rescue
216
+ project('foo').test.failed_tests.should include('StringSpecs$')
217
+ end
218
+ end
219
+
220
+ elsif Buildr::VERSION >= '1.5'
221
+ raise "JVM version guard in #{__FILE__} should be removed since it is assumed that Java 1.5 is no longer supported."
222
+ end
@@ -13,9 +13,10 @@
13
13
  # License for the specific language governing permissions and limitations under
14
14
  # the License.
15
15
 
16
-
17
16
  require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers'))
18
17
 
18
+ if Java.java.lang.System.getProperty("java.runtime.version") >= "1.6"
19
+
19
20
  # TODO's
20
21
  # -test passing System props
21
22
  # -test passing ENV variables
@@ -289,3 +290,6 @@ describe Buildr::Scala::ScalaTest do
289
290
 
290
291
  end
291
292
 
293
+ elsif Buildr::VERSION >= '1.5'
294
+ raise "JVM version guard in #{__FILE__} should be removed since it is assumed that Java 1.5 is no longer supported."
295
+ end