Sha256: 13d4308ca632843fe0f50adac6a9e04fc1465e19a4d7ed36dfe0176e69fa822b

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

require File.dirname(__FILE__) + '/spec_helper'

describe Culerity::RemoteObjectProxy do
  it "should send the serialized method call to the output" do
    io = stub 'io', :gets => '[:return]'
    io.should_receive(:<<).with("[345, \"goto\", \"/homepage\"]\n")
    proxy = Culerity::RemoteObjectProxy.new 345, io
    proxy.goto '/homepage'
  end
  
  it "should return the deserialized return value" do
    io = stub 'io', :gets => "[:return, :okay]\n", :<< => nil
    proxy = Culerity::RemoteObjectProxy.new 345, io
    proxy.goto.should == :okay
  end
  
  it "should raise the received exception" do
    io = stub 'io', :gets => "[:exception, RuntimeError, \"test exception\", []]", :<< => nil
    proxy = Culerity::RemoteObjectProxy.new 345, io
    lambda {
      proxy.goto '/home'
    }.should raise_error(RuntimeError, 'test exception')
  end
  
  it "should send exit" do
    io = stub 'io', :gets => '[:return]'
    io.should_receive(:<<).with('["_exit_"]')
    proxy = Culerity::RemoteObjectProxy.new 345, io
    proxy.exit
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
langalex-culerity-0.1.3 spec/remote_object_proxy_spec.rb
langalex-culerity-0.1.4 spec/remote_object_proxy_spec.rb