Created
August 26, 2009 18:24
-
-
Save brentd/175700 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/culerity/celerity_server.rb b/lib/culerity/celerity_server.rb | |
index c89e2d7..d2eb5c7 100644 | |
--- a/lib/culerity/celerity_server.rb | |
+++ b/lib/culerity/celerity_server.rb | |
@@ -69,7 +69,8 @@ module Culerity | |
def proxify(result, in_array = false) | |
if result.is_a?(Array) | |
- result.map {|x| proxify(x, true) }.inspect | |
+ values = result.map {|x| proxify(x, true) } | |
+ "[#{values.join(', ')}]" | |
elsif [String, TrueClass, FalseClass, Fixnum, Float, NilClass].include?(result.class) | |
in_array ? result : result.inspect | |
else | |
diff --git a/spec/celerity_server_spec.rb b/spec/celerity_server_spec.rb | |
index 01a8b7a..7b5793c 100644 | |
--- a/spec/celerity_server_spec.rb | |
+++ b/spec/celerity_server_spec.rb | |
@@ -67,6 +67,15 @@ describe Culerity::CelerityServer do | |
Culerity::CelerityServer.new(_in, _out) | |
end | |
+ it "should send back an array of proxy objects if the return value is an array" do | |
+ @browser.stub!(:goto).and_return([stub('123', :object_id => 456), stub('123', :object_id => 457)]) | |
+ _in = stub 'in' | |
+ _in.stub!(:gets).and_return("[\"browser0\", \"goto\", \"/homepage\"]\n", "[\"_exit_\"]\n") | |
+ _out = stub 'out' | |
+ _out.should_receive(:<<).with("[:return, [Culerity::RemoteObjectProxy.new(456, @io), Culerity::RemoteObjectProxy.new(457, @io)]]\n") | |
+ Culerity::CelerityServer.new(_in, _out) | |
+ end | |
+ | |
it "should pass the method call to a proxy" do | |
proxy = stub('123', :object_id => 456) | |
@browser.stub!(:goto).and_return(proxy) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment