[macruby-changes] [1444] MacRuby/branches/experimental/spec/frozen/language/file_spec.rb
source_changes at macosforge.org
source_changes at macosforge.org
Wed Apr 22 15:08:03 PDT 2009
Revision: 1444
http://trac.macosforge.org/projects/ruby/changeset/1444
Author: eloy.de.enige at gmail.com
Date: 2009-04-22 15:08:02 -0700 (Wed, 22 Apr 2009)
Log Message:
-----------
Correct load path expectation and add relative path expectation for __FILE__
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:07:50 UTC (rev 1443)
+++ MacRuby/branches/experimental/spec/frozen/language/file_spec.rb 2009-04-22 22:08:02 UTC (rev 1444)
@@ -6,18 +6,32 @@
it "equals the current filename" do
File.basename(__FILE__).should == "file_spec.rb"
end
-
- it "equals the full path to the file when required" do
- $:.unshift File.dirname(__FILE__) + '/fixtures'
- begin
- require 'file.rb'
- ScratchPad.recorded.should == File.dirname(__FILE__) + '/fixtures/file.rb'
- ensure
- $:.shift
- end
- end
it "equals (eval) inside an eval" do
eval("__FILE__").should == "(eval)"
end
+
+ it "equals a relative path when required using a relative path" do
+ path = "language/fixtures/file.rb"
+ require path
+ ScratchPad.recorded.should == "./#{path}"
+ end
end
+
+
+describe "The __FILE__ constant" do
+ before(:each) do
+ path = fixture(__FILE__,"file.rb")
+ #puts "@@@@ Path is #{path} for fixture(#{__FILE__},'file.rb')"
+ $:.unshift File.dirname(path)
+ end
+ after(:each) do
+ $:.shift
+ end
+
+ it "equals the full path to the file when required" do
+ require 'file.rb'
+ ScratchPad.recorded.should == fixture(__FILE__, 'file.rb')
+ end
+
+end
\ No newline at end of file
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090422/ecbe05e7/attachment.html>
More information about the macruby-changes
mailing list