THRIFT-374. rb: ruby 1.9 compatibility
This patch updates the thrift_native package to use 1.9 compatible macros and fixes the pure ruby stuff to behave equally well in ruby1.8.6-ruby1.9.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@758435 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/rb/spec/binaryprotocol_spec_shared.rb b/lib/rb/spec/binaryprotocol_spec_shared.rb
index 1d685b6..1ff8d84 100644
--- a/lib/rb/spec/binaryprotocol_spec_shared.rb
+++ b/lib/rb/spec/binaryprotocol_spec_shared.rb
@@ -88,8 +88,6 @@
@prot.write_byte(i)
@trans.read(1).should == [i].pack('c')
end
- (-128..127).each do |i|
- end
# handing it numbers out of signed range should clip
@trans.rspec_verify
(128..255).each do |i|
diff --git a/lib/rb/spec/client_spec.rb b/lib/rb/spec/client_spec.rb
index 980552b..5ce0139 100644
--- a/lib/rb/spec/client_spec.rb
+++ b/lib/rb/spec/client_spec.rb
@@ -40,10 +40,10 @@
@prot.should_receive(:write_message_begin).with('testMessage2', MessageTypes::CALL, 1).ordered
@prot.should_receive(:write_message_begin).with('testMessage3', MessageTypes::CALL, 2).ordered
@prot.stub!(:write_message_end)
- @prot.stub!(:trans).and_return stub_everything("trans")
- @client.send_message('testMessage', stub_everything("args class"))
- @client.send_message('testMessage2', stub_everything("args class"))
- @client.send_message('testMessage3', stub_everything("args class"))
+ @prot.stub!(:trans).and_return mock("trans").as_null_object
+ @client.send_message('testMessage', mock("args class").as_null_object)
+ @client.send_message('testMessage2', mock("args class").as_null_object)
+ @client.send_message('testMessage3', mock("args class").as_null_object)
end
end
diff --git a/lib/rb/spec/server_spec.rb b/lib/rb/spec/server_spec.rb
index 545ea28..874085c 100644
--- a/lib/rb/spec/server_spec.rb
+++ b/lib/rb/spec/server_spec.rb
@@ -39,9 +39,9 @@
x = 0
@processor.should_receive(:process).exactly(3).times.with(@prot, @prot).and_return do
case (x += 1)
- when 1: raise Thrift::TransportException
- when 2: raise Thrift::ProtocolException
- when 3: throw :stop
+ when 1 then raise Thrift::TransportException
+ when 2 then raise Thrift::ProtocolException
+ when 3 then throw :stop
end
end
@trans.should_receive(:close).exactly(3).times
@@ -66,9 +66,9 @@
x = 0
@processor.should_receive(:process).exactly(3).times.with(@prot, @prot).and_return do
case (x += 1)
- when 1: raise Thrift::TransportException
- when 2: raise Thrift::ProtocolException
- when 3: throw :stop
+ when 1 then raise Thrift::TransportException
+ when 2 then raise Thrift::ProtocolException
+ when 3 then throw :stop
end
end
@trans.should_receive(:close).exactly(3).times
@@ -127,9 +127,9 @@
error = RuntimeError.new("Stopped")
@processor.should_receive(:process).exactly(3).times.with(@prot, @prot).and_return do
case (x += 1)
- when 1: raise Thrift::TransportException
- when 2: raise Thrift::ProtocolException
- when 3: raise error
+ when 1 then raise Thrift::TransportException
+ when 2 then raise Thrift::ProtocolException
+ when 3 then raise error
end
end
@trans.should_receive(:close).exactly(3).times