[macruby-changes] [1451] MacRuby/branches/experimental/spec/frozen/language/file_spec.rb

source_changes at macosforge.org source_changes at macosforge.org
Wed Apr 22 15:09:24 PDT 2009


Revision: 1451
          http://trac.macosforge.org/projects/ruby/changeset/1451
Author:   eloy.de.enige at gmail.com
Date:     2009-04-22 15:09:23 -0700 (Wed, 22 Apr 2009)
Log Message:
-----------
Use chdir to make a relative-requiring __FILE__ spec more robust.

Modified Paths:
--------------
    MacRuby/branches/experimental/spec/frozen/language/file_spec.rb

Modified: MacRuby/branches/experimental/spec/frozen/language/file_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/language/file_spec.rb	2009-04-22 22:09:15 UTC (rev 1450)
+++ MacRuby/branches/experimental/spec/frozen/language/file_spec.rb	2009-04-22 22:09:23 UTC (rev 1451)
@@ -12,9 +12,12 @@
   end
   
   it "equals a relative path when required using a relative path" do
-    path = "language/fixtures/file.rb"
-    require path
-    ScratchPad.recorded.should == File.join(".",path)
+    base_path = File.dirname(File.dirname(fixture(__FILE__, "file.rb")))
+    path = "fixtures/file.rb"
+    Dir.chdir(base_path) do
+      require path
+      ScratchPad.recorded.should == File.join(".",path)
+    end
   end
   
   it "equals the full path when required using a full path" do
@@ -40,4 +43,4 @@
     ScratchPad.recorded.should == fixture(__FILE__, 'file.rb')
   end
   
-end
\ No newline at end of file
+end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090422/d5d59ac9/attachment-0001.html>


More information about the macruby-changes mailing list