Sha256: ad04c4e1363a416cf5d72ab8d48bbeb3fc60c40775d93959252de67651fb7de9
Contents?: true
Size: 1.48 KB
Versions: 1
Compression:
Stored size: 1.48 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe MarilynRPC::Gentleman do before(:each) do module MarilynRPC def self.serialize(obj) obj end end class DeferObjectMock attr_accessor :callback def callback(&block) @callback = block end def call(*args) @callback.call(*args) end end class ConnectionMock attr_accessor :data def send_data(obj) @data = obj end end end it "should be possible to defer a process to a gentleman" do deferable = DeferObjectMock.new g = MarilynRPC::Gentleman.new(deferable) do |a, b| a + b end g.connection = ConnectionMock.new deferable.call(1, 2) unpack_envelope(g.connection.data).result.should == 3 end it "should be possible to defer a process to a gentleman" do deferable = DeferObjectMock.new g = MarilynRPC::Gentleman.new(deferable) do |a, b| raise Exception.new end g.connection = ConnectionMock.new deferable.call(1, 2) unpack_envelope(g.connection.data).exception.should be_a(Exception) end it "should be possible to create a gentleman helper" do callback = nil g = MarilynRPC::Gentleman.proxy do |helper| callback = helper lambda do |a, b| a + b end end g.connection = ConnectionMock.new callback.call(1, 2) unpack_envelope(g.connection.data).result.should == 3 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
marilyn-rpc-0.0.4 | spec/gentleman_spec.rb |