Sha256: cb8d3770b80b1290eeb6ae5dce4c9dbcc8bc7e9699552ff8e6a0115c264735a0

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 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, '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.1 spec/remote_object_proxy_spec.rb
langalex-culerity-0.1.2 spec/remote_object_proxy_spec.rb