Sha256: fa8ca35d99eb82c356ad40c073df722748d9ef15f653c5cce9662e726721f28f

Contents?: true

Size: 1.02 KB

Versions: 5

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(Culerity::CulerityException)
  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

5 entries across 5 versions & 2 rubygems

Version Path
caius-culerity-0.1.5 spec/remote_object_proxy_spec.rb
caius-culerity-0.1.6 spec/remote_object_proxy_spec.rb
caius-culerity-0.1.7 spec/remote_object_proxy_spec.rb
langalex-culerity-0.1.5 spec/remote_object_proxy_spec.rb
langalex-culerity-0.1.7 spec/remote_object_proxy_spec.rb