You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by dj...@apache.org on 2009/06/20 00:04:53 UTC

svn commit: r786688 - /buildr/trunk/spec/scala/compiler_spec.rb

Author: djspiewak
Date: Fri Jun 19 22:04:53 2009
New Revision: 786688

URL: http://svn.apache.org/viewvc?rev=786688&view=rev
Log:
Added specs for SCALA_HOME-less compilation

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

Modified: buildr/trunk/spec/scala/compiler_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/scala/compiler_spec.rb?rev=786688&r1=786687&r2=786688&view=diff
==============================================================================
--- buildr/trunk/spec/scala/compiler_spec.rb (original)
+++ buildr/trunk/spec/scala/compiler_spec.rb Fri Jun 19 22:04:53 2009
@@ -17,7 +17,8 @@
 require File.join(File.dirname(__FILE__), '../spec_helpers')
 require 'buildr/scala'
 
-describe 'scalac compiler' do
+# need to test both with and without SCALA_HOME
+share_as :ScalacCompiler do
   it 'should identify itself from source directories' do
     write 'src/main/scala/com/example/Test.scala', 'package com.example; class Test { val i = 1 }' 
     define('foo').compile.compiler.should eql(:scalac)
@@ -110,6 +111,34 @@
 end
 
 
+describe 'scala compiler (installed in SCALA_HOME)' do
+  it 'requires present SCALA_HOME' do
+    ENV['SCALA_HOME'].should_not be_nil
+  end
+  
+  it_should_behave_like ScalacCompiler
+end
+
+
+describe 'scala compiler (downloaded from repository)' do
+  old_home = ENV['SCALA_HOME']
+  
+  before :all do
+    ENV['SCALA_HOME'] = nil
+  end
+  
+  it 'requires absent SCALA_HOME' do
+    ENV['SCALA_HOME'].should be_nil
+  end
+  
+  it_should_behave_like ScalacCompiler
+  
+  after :all do
+    ENV['SCALA_HOME'] = old_home
+  end
+end
+
+
 describe 'scalac compiler options' do
   def compile_task
     @compile_task ||= define('foo').compile.using(:scalac)