buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From as...@apache.org
Subject svn commit: r748430 - /buildr/trunk/spec/scala/tests_spec.rb
Date Fri, 27 Feb 2009 08:49:49 GMT
Author: assaf
Date: Fri Feb 27 08:49:49 2009
New Revision: 748430

URL: http://svn.apache.org/viewvc?rev=748430&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=748430&r1=748429&r2=748430&view=diff
==============================================================================
--- buildr/trunk/spec/scala/tests_spec.rb (original)
+++ buildr/trunk/spec/scala/tests_spec.rb Fri Feb 27 08:49:49 2009
@@ -244,6 +244,41 @@
     project('foo').test.failed_tests.should include('StringSpecs')
   end
       
+  it 'should set current directory' do
+    mkpath 'baz'
+    expected = File.expand_path('baz')
+    expected.gsub!('/', '\\') if expected =~ /^[A-Z]:/ # Java returns back slashed paths
for windows
+    write 'baz/src/test/scala/CurrentDirectoryTestSuite.scala', <<-SCALA
+      class CurrentDirectoryTestSuite extends org.scalatest.FunSuite {
+        test("testCurrentDirectory") {
+          assert("value" === System.getenv("NAME"))
+          assert(#{expected.inspect} === new java.io.File(".").getCanonicalPath())
+        }
+      }
+    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 run with ScalaCheck automatic test case generation' do
     write 'src/test/scala/MySuite.scala', <<-SCALA
       import org.scalatest.prop.PropSuite



Mime
View raw message