You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by bo...@apache.org on 2009/02/22 18:09:56 UTC

svn commit: r746772 - /buildr/trunk/spec/scala/tests_spec.rb

Author: boisvert
Date: Sun Feb 22 17:09:55 2009
New Revision: 746772

URL: http://svn.apache.org/viewvc?rev=746772&view=rev
Log:
BUILDR-94: Add specs for Scala Specs integration

Modified:
    buildr/trunk/spec/scala/tests_spec.rb

Modified: buildr/trunk/spec/scala/tests_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/scala/tests_spec.rb?rev=746772&r1=746771&r2=746772&view=diff
==============================================================================
--- buildr/trunk/spec/scala/tests_spec.rb (original)
+++ buildr/trunk/spec/scala/tests_spec.rb Sun Feb 22 17:09:55 2009
@@ -191,6 +191,42 @@
     project('foo').test.invoke
   end
 
+  it 'should compile and run specifications with "Specs" suffix' do
+    write 'src/test/scala/HelloWorldSpecs.scala', <<-SCALA
+      import org.specs._
+  
+      object HelloWorldSpecs extends Specification {
+        "'hello world' has 11 characters" in {
+          "hello world".size must beEqualTo(11)
+        }
+        "'hello world' matches 'h.* w.*'" in {
+          "hello world" must beMatching("h.* w.*")
+        }
+      }
+    SCALA
+    define('foo').test.using :scalatest
+    project('foo').test.invoke
+    project('foo').test.passed_tests.should include('HelloWorldSpecs')
+  end
+
+  it 'should fail if specifications fail' do
+    write 'src/test/scala/StringSpecs.scala', <<-SCALA
+      import org.specs._
+      import org.specs.runner._
+      
+      object StringSpecs extends Specification {
+        "empty string" should {
+          "have a zero length" in {
+            ("".length) mustEqual(1)
+          }
+        }
+      }
+    SCALA
+    define('foo')
+    project('foo').test.invoke rescue
+    project('foo').test.failed_tests.should include('StringSpecs')
+  end
+      
   it 'should set current directory' do
     mkpath 'baz'
     expected = File.expand_path('baz')