Title: [waffle-scm] [305] trunk/core/src/main/ruby/org/codehaus/waffle: fixed ERB::Util#partial to use File.exist? instead of Kernel.test which apparently does not work correctly in JRuby
Revision
305
Author
mward
Date
2007-08-09 16:19:25 -0500 (Thu, 09 Aug 2007)

Log Message

fixed ERB::Util#partial to use File.exist? instead of Kernel.test which apparently does not work correctly in JRuby

Modified Paths

Diff

Modified: trunk/core/src/main/ruby/org/codehaus/waffle/erb_extension.rb (304 => 305)

--- trunk/core/src/main/ruby/org/codehaus/waffle/erb_extension.rb	2007-08-09 19:06:11 UTC (rev 304)
+++ trunk/core/src/main/ruby/org/codehaus/waffle/erb_extension.rb	2007-08-09 21:19:25 UTC (rev 305)
@@ -41,7 +41,7 @@
       # Locate full path to template (*.rhtml)
       path = Waffle::ScriptLoader.locate_template(file_name)
 
-      return "File Not Found: Unable to render file '#{path}'." unless Kernel.test(?f, path)
+      return "File Not Found: Unable to render file '#{path}'." unless File.exist?(path)
 
       template = ''
       File.open(path).each { |line| template << line }

Modified: trunk/core/src/main/ruby/org/codehaus/waffle/waffle.rb (304 => 305)

--- trunk/core/src/main/ruby/org/codehaus/waffle/waffle.rb	2007-08-09 19:06:11 UTC (rev 304)
+++ trunk/core/src/main/ruby/org/codehaus/waffle/waffle.rb	2007-08-09 21:19:25 UTC (rev 305)
@@ -68,6 +68,7 @@
       store(key, value)
     end
 
+    # propogate unknown method calls to the underlying context
     def method_missing(symbol, *args)
       @__context.send(symbol, *args)
     end
@@ -150,7 +151,7 @@
           begin
             self.instance_eval("@#{key} = '#{value}'")
           rescue Exception => e
-            p "ERROR handling request parameter #{key} with value: #{value}\n #{e}"
+            print("ERROR handling request parameter #{key} with value: #{value}\n #{e}\n")
           end
         end
       end

Modified: trunk/core/src/test/specs/org/codehaus/waffle/servlet/erb_extension_spec.rb (304 => 305)

--- trunk/core/src/test/specs/org/codehaus/waffle/servlet/erb_extension_spec.rb	2007-08-09 19:06:11 UTC (rev 304)
+++ trunk/core/src/test/specs/org/codehaus/waffle/servlet/erb_extension_spec.rb	2007-08-09 21:19:25 UTC (rev 305)
@@ -46,7 +46,7 @@
   it "should locate file and render through ERB" do
     controller = FakeController.new
 
-    Kernel.should_receive(:test).with(?f, 'file path').and_return(true)
+    File.should_receive(:exist?).with('file path').and_return(true)
     Waffle::ScriptLoader.should_receive(:locate_template).with('file name').and_return("file path")
     File.should_receive(:open).with('file path').and_return([%{Name: <[EMAIL PROTECTED]> Foo: <%=foo%>}])
 


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to