Sha256: f9479d7641301f6373f6948c7f2e3de6e1d7875d4f0021c0218fc174f90604bd
Contents?: true
Size: 1.05 KB
Versions: 2
Compression:
Stored size: 1.05 KB
Contents
require 'spec_helper' require 'protobuf/rpc/server' require 'spec/proto/test_service_impl' describe Protobuf::Rpc::Server do context 'when sending response objects' do it 'should be able to send a hash object as a response' do server = Protobuf::Rpc::Server.new # Setup the right mocks server.instance_variable_set(:@klass, Spec::Proto::TestService) response_wrapper = mock('response') response_wrapper.stub(:response_proto=) server.instance_variable_set(:@response, response_wrapper) Spec::Proto::TestService.stub_chain(:rpcs, :[], :[], :response_type).and_return(Spec::Proto::ResourceFindRequest) # Setup expectations hash_response = {:name => 'Test Name', :active => false} expected = Spec::Proto::ResourceFindRequest.new(hash_response) Spec::Proto::ResourceFindRequest.should_receive(:new).with(hash_response).and_return(expected) server.should_not_receive(:handle_error) # Call the method server.send(:parse_response_from_service, hash_response) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
protobuf-1.0.1 | spec/unit/rpc/server_spec.rb |
protobuf-1.0.0 | spec/unit/server_spec.rb |