THRIFT-4342: update ruby tests to use rspec 3, updated all dependencies for ruby
Client: rb
diff --git a/lib/rb/spec/client_spec.rb b/lib/rb/spec/client_spec.rb
index f8ffe8a..d5d4cee 100644
--- a/lib/rb/spec/client_spec.rb
+++ b/lib/rb/spec/client_spec.rb
@@ -26,74 +26,73 @@
   end
 
   before(:each) do
-    @prot = mock("MockProtocol")
+    @prot = double("MockProtocol")
     @client = ClientSpec.new(@prot)
   end
 
   describe Thrift::Client do
     it "should re-use iprot for oprot if not otherwise specified" do
-      @client.instance_variable_get(:'@iprot').should eql(@prot)
-      @client.instance_variable_get(:'@oprot').should eql(@prot)
+      expect(@client.instance_variable_get(:'@iprot')).to eql(@prot)
+      expect(@client.instance_variable_get(:'@oprot')).to eql(@prot)
     end
 
     it "should send a test message" do
-      @prot.should_receive(:write_message_begin).with('testMessage', Thrift::MessageTypes::CALL, 0)
-      mock_args = mock('#<TestMessage_args:mock>')
-      mock_args.should_receive(:foo=).with('foo')
-      mock_args.should_receive(:bar=).with(42)
-      mock_args.should_receive(:write).with(@prot)
-      @prot.should_receive(:write_message_end)
-      @prot.should_receive(:trans) do
-        mock('trans').tap do |trans|
-          trans.should_receive(:flush)
+      expect(@prot).to receive(:write_message_begin).with('testMessage', Thrift::MessageTypes::CALL, 0)
+      mock_args = double('#<TestMessage_args:mock>')
+      expect(mock_args).to receive(:foo=).with('foo')
+      expect(mock_args).to receive(:bar=).with(42)
+      expect(mock_args).to receive(:write).with(@prot)
+      expect(@prot).to receive(:write_message_end)
+      expect(@prot).to receive(:trans) do
+        double('trans').tap do |trans|
+          expect(trans).to receive(:flush)
         end
       end
-      klass = stub("TestMessage_args", :new => mock_args)
+      klass = double("TestMessage_args", :new => mock_args)
       @client.send_message('testMessage', klass, :foo => 'foo', :bar => 42)
     end
 
     it "should increment the sequence id when sending messages" do
-      pending "it seems sequence ids are completely ignored right now" do
-        @prot.should_receive(:write_message_begin).with('testMessage',  Thrift::MessageTypes::CALL, 0).ordered
-        @prot.should_receive(:write_message_begin).with('testMessage2', Thrift::MessageTypes::CALL, 1).ordered
-        @prot.should_receive(:write_message_begin).with('testMessage3', Thrift::MessageTypes::CALL, 2).ordered
-        @prot.stub!(:write_message_end)
-        @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
+      pending "it seems sequence ids are completely ignored right now"
+      @prot.expect(:write_message_begin).with('testMessage',  Thrift::MessageTypes::CALL, 0).ordered
+      @prot.expect(:write_message_begin).with('testMessage2', Thrift::MessageTypes::CALL, 1).ordered
+      @prot.expect(:write_message_begin).with('testMessage3', Thrift::MessageTypes::CALL, 2).ordered
+      @prot.stub!(:write_message_end)
+      @prot.stub!(:trans).and_return double("trans").as_null_object
+      @client.send_message('testMessage', double("args class").as_null_object)
+      @client.send_message('testMessage2', double("args class").as_null_object)
+      @client.send_message('testMessage3', double("args class").as_null_object)
     end
 
     it "should receive a test message" do
-      @prot.should_receive(:read_message_begin).and_return [nil, Thrift::MessageTypes::CALL, 0]
-      @prot.should_receive(:read_message_end)
-      mock_klass = mock("#<MockClass:mock>")
-      mock_klass.should_receive(:read).with(@prot)
-      @client.receive_message(stub("MockClass", :new => mock_klass))
+      expect(@prot).to receive(:read_message_begin).and_return [nil, Thrift::MessageTypes::CALL, 0]
+      expect(@prot).to receive(:read_message_end)
+      mock_klass = double("#<MockClass:mock>")
+      expect(mock_klass).to receive(:read).with(@prot)
+      @client.receive_message(double("MockClass", :new => mock_klass))
     end
 
     it "should handle received exceptions" do
-      @prot.should_receive(:read_message_begin).and_return [nil, Thrift::MessageTypes::EXCEPTION, 0]
-      @prot.should_receive(:read_message_end)
-      Thrift::ApplicationException.should_receive(:new).and_return do
+      expect(@prot).to receive(:read_message_begin).and_return [nil, Thrift::MessageTypes::EXCEPTION, 0]
+      expect(@prot).to receive(:read_message_end)
+      expect(Thrift::ApplicationException).to receive(:new) do
         StandardError.new.tap do |mock_exc|
-          mock_exc.should_receive(:read).with(@prot)
+          expect(mock_exc).to receive(:read).with(@prot)
         end
       end
-      lambda { @client.receive_message(nil) }.should raise_error(StandardError)
+      expect { @client.receive_message(nil) }.to raise_error(StandardError)
     end
 
     it "should close the transport if an error occurs while sending a message" do
-      @prot.stub!(:write_message_begin)
-      @prot.should_not_receive(:write_message_end)
-      mock_args = mock("#<TestMessage_args:mock>")
-      mock_args.should_receive(:write).with(@prot).and_raise(StandardError)
-      trans = mock("MockTransport")
-      @prot.stub!(:trans).and_return(trans)
-      trans.should_receive(:close)
-      klass = mock("TestMessage_args", :new => mock_args)
-      lambda { @client.send_message("testMessage", klass) }.should raise_error(StandardError)
+      allow(@prot).to receive(:write_message_begin)
+      expect(@prot).not_to receive(:write_message_end)
+      mock_args = double("#<TestMessage_args:mock>")
+      expect(mock_args).to receive(:write).with(@prot).and_raise(StandardError)
+      trans = double("MockTransport")
+      allow(@prot).to receive(:trans).and_return(trans)
+      expect(trans).to receive(:close)
+      klass = double("TestMessage_args", :new => mock_args)
+      expect { @client.send_message("testMessage", klass) }.to raise_error(StandardError)
     end
   end
 end