You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by jk...@apache.org on 2018/03/23 19:17:17 UTC

[3/3] thrift git commit: THRIFT-4342: update ruby tests to use rspec 3, updated all dependencies for ruby Client: rb

THRIFT-4342: update ruby tests to use rspec 3, updated all dependencies for ruby
Client: rb


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/27247079
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/27247079
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/27247079

Branch: refs/heads/master
Commit: 272470790ad6db791bd6f9db399b2cd2d5879f74
Parents: dab4529
Author: James E. King III <jk...@apache.org>
Authored: Thu Mar 22 20:50:23 2018 -0400
Committer: James E. King III <jk...@apache.org>
Committed: Fri Mar 23 15:16:47 2018 -0400

----------------------------------------------------------------------
 .travis.yml                                     |   4 +-
 build/docker/ubuntu-artful/Dockerfile           |   1 -
 build/docker/ubuntu-xenial/Dockerfile           |   1 -
 debian/control                                  |   6 +-
 lib/rb/spec/base_protocol_spec.rb               | 146 +++++-----
 lib/rb/spec/base_transport_spec.rb              | 262 ++++++++---------
 lib/rb/spec/binary_protocol_accelerated_spec.rb |   4 +-
 lib/rb/spec/binary_protocol_spec.rb             |  20 +-
 lib/rb/spec/binary_protocol_spec_shared.rb      | 143 +++++-----
 lib/rb/spec/bytes_spec.rb                       |  76 ++---
 lib/rb/spec/client_spec.rb                      |  83 +++---
 lib/rb/spec/compact_protocol_spec.rb            |  22 +-
 lib/rb/spec/exception_spec.rb                   | 108 +++----
 lib/rb/spec/flat_spec.rb                        |  10 +-
 lib/rb/spec/http_client_spec.rb                 |  76 ++---
 lib/rb/spec/json_protocol_spec.rb               | 280 +++++++++----------
 lib/rb/spec/namespaced_spec.rb                  |  10 +-
 lib/rb/spec/nonblocking_server_spec.rb          |  32 +--
 lib/rb/spec/processor_spec.rb                   |  52 ++--
 lib/rb/spec/serializer_spec.rb                  |  40 +--
 lib/rb/spec/server_socket_spec.rb               |  46 +--
 lib/rb/spec/server_spec.rb                      | 140 +++++-----
 lib/rb/spec/socket_spec.rb                      |  34 +--
 lib/rb/spec/socket_spec_shared.rb               |  62 ++--
 lib/rb/spec/ssl_server_socket_spec.rb           |   2 +-
 lib/rb/spec/ssl_socket_spec.rb                  |  46 +--
 lib/rb/spec/struct_nested_containers_spec.rb    |  48 ++--
 lib/rb/spec/struct_spec.rb                      | 240 ++++++++--------
 lib/rb/spec/thin_http_server_spec.rb            |  36 +--
 lib/rb/spec/types_spec.rb                       | 105 +++----
 lib/rb/spec/union_spec.rb                       |  84 +++---
 lib/rb/spec/unix_socket_spec.rb                 |  74 ++---
 lib/rb/thrift.gemspec                           |  15 +-
 test/rb/Gemfile                                 |   6 +-
 34 files changed, 1160 insertions(+), 1154 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/27247079/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 2816fac..b3a6a26 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -158,13 +158,13 @@ jobs:
     - script: build/docker/run.sh
       env:
         - JOB="make dist"
-        - DISTRO=ubuntu-xenial
+        - DISTRO=ubuntu-artful
         - SCRIPT="make-dist.sh"
 
     - script: build/docker/run.sh
       env:
         - JOB="Debian Packages"
-        - DISTRO=ubuntu-xenial
+        - DISTRO=ubuntu-artful
         - SCRIPT="dpkg.sh"
 
   ### ------------------------- phase: osx -------------------------

http://git-wip-us.apache.org/repos/asf/thrift/blob/27247079/build/docker/ubuntu-artful/Dockerfile
----------------------------------------------------------------------
diff --git a/build/docker/ubuntu-artful/Dockerfile b/build/docker/ubuntu-artful/Dockerfile
index 78d9761..d712bec 100644
--- a/build/docker/ubuntu-artful/Dockerfile
+++ b/build/docker/ubuntu-artful/Dockerfile
@@ -240,7 +240,6 @@ RUN apt-get install -y --no-install-recommends \
       ruby \
       ruby-dev \
       ruby-bundler
-RUN gem install bundler --no-ri --no-rdoc
 
 RUN apt-get install -y --no-install-recommends \
 `# Rust dependencies` \

http://git-wip-us.apache.org/repos/asf/thrift/blob/27247079/build/docker/ubuntu-xenial/Dockerfile
----------------------------------------------------------------------
diff --git a/build/docker/ubuntu-xenial/Dockerfile b/build/docker/ubuntu-xenial/Dockerfile
index ec2c849..760c501 100644
--- a/build/docker/ubuntu-xenial/Dockerfile
+++ b/build/docker/ubuntu-xenial/Dockerfile
@@ -239,7 +239,6 @@ RUN apt-get install -y --no-install-recommends \
       ruby \
       ruby-dev \
       ruby-bundler
-RUN gem install bundler --no-ri --no-rdoc
 
 RUN apt-get install -y --no-install-recommends \
 `# Rust dependencies` \

http://git-wip-us.apache.org/repos/asf/thrift/blob/27247079/debian/control
----------------------------------------------------------------------
diff --git a/debian/control b/debian/control
index 218d217..cb8a376 100644
--- a/debian/control
+++ b/debian/control
@@ -3,12 +3,12 @@ Section: devel
 Priority: extra
 Build-Depends: debhelper (>= 9), build-essential, mono-mcs, python-dev, ant,
     mono-devel,  libmono-system-web4.0-cil, erlang-base, ruby-dev | ruby1.9.1-dev, ruby-bundler ,autoconf, automake,
-    pkg-config, libtool, bison, flex, libboost-dev | libboost1.53-dev,
+    pkg-config, libtool, bison, flex, libboost-dev | libboost1.53-dev | libboost1.63-all-dev,
     python-all, python-setuptools, python-all-dev, python-all-dbg,
     python3-all, python3-setuptools, python3-all-dev, python3-all-dbg,
     openjdk-7-jdk | openjdk-8-jdk | default-jdk,
-    libboost-test-dev | libboost-test1.53-dev, libevent-dev, libssl-dev, perl (>= 5.8.0-7),
-    php5 | php7.0, php5-dev | php7.0-dev, libglib2.0-dev, qtchooser, qtbase5-dev-tools
+    libboost-test-dev | libboost-test1.53-dev | libboost-test1.63-dev, libevent-dev, libssl-dev, perl (>= 5.8.0-7),
+    php (>= 5), php-dev (>= 5), libglib2.0-dev, qtchooser, qtbase5-dev-tools
 Maintainer: Thrift Developer's <de...@thrift.apache.org>
 Homepage: http://thrift.apache.org/
 Vcs-Git: https://git-wip-us.apache.org/repos/asf/thrift.git

http://git-wip-us.apache.org/repos/asf/thrift/blob/27247079/lib/rb/spec/base_protocol_spec.rb
----------------------------------------------------------------------
diff --git a/lib/rb/spec/base_protocol_spec.rb b/lib/rb/spec/base_protocol_spec.rb
index d31e811..eca936b 100644
--- a/lib/rb/spec/base_protocol_spec.rb
+++ b/lib/rb/spec/base_protocol_spec.rb
@@ -22,7 +22,7 @@ require 'spec_helper'
 describe 'BaseProtocol' do
 
   before(:each) do
-    @trans = mock("MockTransport")
+    @trans = double("MockTransport")
     @prot = Thrift::BaseProtocol.new(@trans)
   end
 
@@ -30,38 +30,38 @@ describe 'BaseProtocol' do
     # most of the methods are stubs, so we can ignore them
 
     it "should provide a reasonable to_s" do
-      @trans.should_receive(:to_s).once.and_return("trans")
-      @prot.to_s.should == "trans"
+      expect(@trans).to receive(:to_s).once.and_return("trans")
+      expect(@prot.to_s).to eq("trans")
     end
 
     it "should make trans accessible" do
-      @prot.trans.should eql(@trans)
+      expect(@prot.trans).to eql(@trans)
     end
 
     it 'should write out a field nicely (deprecated write_field signature)' do
-      @prot.should_receive(:write_field_begin).with('field', 'type', 'fid').ordered
-      @prot.should_receive(:write_type).with({:name => 'field', :type => 'type'}, 'value').ordered
-      @prot.should_receive(:write_field_end).ordered
+      expect(@prot).to receive(:write_field_begin).with('field', 'type', 'fid').ordered
+      expect(@prot).to receive(:write_type).with({:name => 'field', :type => 'type'}, 'value').ordered
+      expect(@prot).to receive(:write_field_end).ordered
       @prot.write_field('field', 'type', 'fid', 'value')
     end
 
     it 'should write out a field nicely' do
-      @prot.should_receive(:write_field_begin).with('field', 'type', 'fid').ordered
-      @prot.should_receive(:write_type).with({:name => 'field', :type => 'type', :binary => false}, 'value').ordered
-      @prot.should_receive(:write_field_end).ordered
+      expect(@prot).to receive(:write_field_begin).with('field', 'type', 'fid').ordered
+      expect(@prot).to receive(:write_type).with({:name => 'field', :type => 'type', :binary => false}, 'value').ordered
+      expect(@prot).to receive(:write_field_end).ordered
       @prot.write_field({:name => 'field', :type => 'type', :binary => false}, 'fid', 'value')
     end
 
     it 'should write out the different types (deprecated write_type signature)' do
-      @prot.should_receive(:write_bool).with('bool').ordered
-      @prot.should_receive(:write_byte).with('byte').ordered
-      @prot.should_receive(:write_double).with('double').ordered
-      @prot.should_receive(:write_i16).with('i16').ordered
-      @prot.should_receive(:write_i32).with('i32').ordered
-      @prot.should_receive(:write_i64).with('i64').ordered
-      @prot.should_receive(:write_string).with('string').ordered
-      struct = mock('Struct')
-      struct.should_receive(:write).with(@prot).ordered
+      expect(@prot).to receive(:write_bool).with('bool').ordered
+      expect(@prot).to receive(:write_byte).with('byte').ordered
+      expect(@prot).to receive(:write_double).with('double').ordered
+      expect(@prot).to receive(:write_i16).with('i16').ordered
+      expect(@prot).to receive(:write_i32).with('i32').ordered
+      expect(@prot).to receive(:write_i64).with('i64').ordered
+      expect(@prot).to receive(:write_string).with('string').ordered
+      struct = double('Struct')
+      expect(struct).to receive(:write).with(@prot).ordered
       @prot.write_type(Thrift::Types::BOOL, 'bool')
       @prot.write_type(Thrift::Types::BYTE, 'byte')
       @prot.write_type(Thrift::Types::DOUBLE, 'double')
@@ -77,16 +77,16 @@ describe 'BaseProtocol' do
     end
 
     it 'should write out the different types' do
-      @prot.should_receive(:write_bool).with('bool').ordered
-      @prot.should_receive(:write_byte).with('byte').ordered
-      @prot.should_receive(:write_double).with('double').ordered
-      @prot.should_receive(:write_i16).with('i16').ordered
-      @prot.should_receive(:write_i32).with('i32').ordered
-      @prot.should_receive(:write_i64).with('i64').ordered
-      @prot.should_receive(:write_string).with('string').ordered
-      @prot.should_receive(:write_binary).with('binary').ordered
-      struct = mock('Struct')
-      struct.should_receive(:write).with(@prot).ordered
+      expect(@prot).to receive(:write_bool).with('bool').ordered
+      expect(@prot).to receive(:write_byte).with('byte').ordered
+      expect(@prot).to receive(:write_double).with('double').ordered
+      expect(@prot).to receive(:write_i16).with('i16').ordered
+      expect(@prot).to receive(:write_i32).with('i32').ordered
+      expect(@prot).to receive(:write_i64).with('i64').ordered
+      expect(@prot).to receive(:write_string).with('string').ordered
+      expect(@prot).to receive(:write_binary).with('binary').ordered
+      struct = double('Struct')
+      expect(struct).to receive(:write).with(@prot).ordered
       @prot.write_type({:type => Thrift::Types::BOOL}, 'bool')
       @prot.write_type({:type => Thrift::Types::BYTE}, 'byte')
       @prot.write_type({:type => Thrift::Types::DOUBLE}, 'double')
@@ -103,13 +103,13 @@ describe 'BaseProtocol' do
     end
 
     it 'should read the different types (deprecated read_type signature)' do
-      @prot.should_receive(:read_bool).ordered
-      @prot.should_receive(:read_byte).ordered
-      @prot.should_receive(:read_i16).ordered
-      @prot.should_receive(:read_i32).ordered
-      @prot.should_receive(:read_i64).ordered
-      @prot.should_receive(:read_double).ordered
-      @prot.should_receive(:read_string).ordered
+      expect(@prot).to receive(:read_bool).ordered
+      expect(@prot).to receive(:read_byte).ordered
+      expect(@prot).to receive(:read_i16).ordered
+      expect(@prot).to receive(:read_i32).ordered
+      expect(@prot).to receive(:read_i64).ordered
+      expect(@prot).to receive(:read_double).ordered
+      expect(@prot).to receive(:read_string).ordered
       @prot.read_type(Thrift::Types::BOOL)
       @prot.read_type(Thrift::Types::BYTE)
       @prot.read_type(Thrift::Types::I16)
@@ -125,14 +125,14 @@ describe 'BaseProtocol' do
     end
 
     it 'should read the different types' do
-      @prot.should_receive(:read_bool).ordered
-      @prot.should_receive(:read_byte).ordered
-      @prot.should_receive(:read_i16).ordered
-      @prot.should_receive(:read_i32).ordered
-      @prot.should_receive(:read_i64).ordered
-      @prot.should_receive(:read_double).ordered
-      @prot.should_receive(:read_string).ordered
-      @prot.should_receive(:read_binary).ordered
+      expect(@prot).to receive(:read_bool).ordered
+      expect(@prot).to receive(:read_byte).ordered
+      expect(@prot).to receive(:read_i16).ordered
+      expect(@prot).to receive(:read_i32).ordered
+      expect(@prot).to receive(:read_i64).ordered
+      expect(@prot).to receive(:read_double).ordered
+      expect(@prot).to receive(:read_string).ordered
+      expect(@prot).to receive(:read_binary).ordered
       @prot.read_type({:type => Thrift::Types::BOOL})
       @prot.read_type({:type => Thrift::Types::BYTE})
       @prot.read_type({:type => Thrift::Types::I16})
@@ -149,13 +149,13 @@ describe 'BaseProtocol' do
     end
 
     it "should skip the basic types" do
-      @prot.should_receive(:read_bool).ordered
-      @prot.should_receive(:read_byte).ordered
-      @prot.should_receive(:read_i16).ordered
-      @prot.should_receive(:read_i32).ordered
-      @prot.should_receive(:read_i64).ordered
-      @prot.should_receive(:read_double).ordered
-      @prot.should_receive(:read_string).ordered
+      expect(@prot).to receive(:read_bool).ordered
+      expect(@prot).to receive(:read_byte).ordered
+      expect(@prot).to receive(:read_i16).ordered
+      expect(@prot).to receive(:read_i32).ordered
+      expect(@prot).to receive(:read_i64).ordered
+      expect(@prot).to receive(:read_double).ordered
+      expect(@prot).to receive(:read_string).ordered
       @prot.skip(Thrift::Types::BOOL)
       @prot.skip(Thrift::Types::BYTE)
       @prot.skip(Thrift::Types::I16)
@@ -168,47 +168,47 @@ describe 'BaseProtocol' do
 
     it "should skip structs" do
       real_skip = @prot.method(:skip)
-      @prot.should_receive(:read_struct_begin).ordered
-      @prot.should_receive(:read_field_begin).exactly(4).times.and_return(
+      expect(@prot).to receive(:read_struct_begin).ordered
+      expect(@prot).to receive(:read_field_begin).exactly(4).times.and_return(
         ['field 1', Thrift::Types::STRING, 1],
         ['field 2', Thrift::Types::I32, 2],
         ['field 3', Thrift::Types::MAP, 3],
         [nil, Thrift::Types::STOP, 0]
       )
-      @prot.should_receive(:read_field_end).exactly(3).times
-      @prot.should_receive(:read_string).exactly(3).times
-      @prot.should_receive(:read_i32).ordered
-      @prot.should_receive(:read_map_begin).ordered.and_return([Thrift::Types::STRING, Thrift::Types::STRING, 1])
+      expect(@prot).to receive(:read_field_end).exactly(3).times
+      expect(@prot).to receive(:read_string).exactly(3).times
+      expect(@prot).to receive(:read_i32).ordered
+      expect(@prot).to receive(:read_map_begin).ordered.and_return([Thrift::Types::STRING, Thrift::Types::STRING, 1])
       # @prot.should_receive(:read_string).exactly(2).times
-      @prot.should_receive(:read_map_end).ordered
-      @prot.should_receive(:read_struct_end).ordered
+      expect(@prot).to receive(:read_map_end).ordered
+      expect(@prot).to receive(:read_struct_end).ordered
       real_skip.call(Thrift::Types::STRUCT)
     end
 
     it "should skip maps" do
       real_skip = @prot.method(:skip)
-      @prot.should_receive(:read_map_begin).ordered.and_return([Thrift::Types::STRING, Thrift::Types::STRUCT, 1])
-      @prot.should_receive(:read_string).ordered
-      @prot.should_receive(:read_struct_begin).ordered.and_return(["some_struct"])
-      @prot.should_receive(:read_field_begin).ordered.and_return([nil, Thrift::Types::STOP, nil]);
-      @prot.should_receive(:read_struct_end).ordered
-      @prot.should_receive(:read_map_end).ordered
+      expect(@prot).to receive(:read_map_begin).ordered.and_return([Thrift::Types::STRING, Thrift::Types::STRUCT, 1])
+      expect(@prot).to receive(:read_string).ordered
+      expect(@prot).to receive(:read_struct_begin).ordered.and_return(["some_struct"])
+      expect(@prot).to receive(:read_field_begin).ordered.and_return([nil, Thrift::Types::STOP, nil]);
+      expect(@prot).to receive(:read_struct_end).ordered
+      expect(@prot).to receive(:read_map_end).ordered
       real_skip.call(Thrift::Types::MAP)
     end
 
     it "should skip sets" do
       real_skip = @prot.method(:skip)
-      @prot.should_receive(:read_set_begin).ordered.and_return([Thrift::Types::I64, 9])
-      @prot.should_receive(:read_i64).ordered.exactly(9).times
-      @prot.should_receive(:read_set_end)
+      expect(@prot).to receive(:read_set_begin).ordered.and_return([Thrift::Types::I64, 9])
+      expect(@prot).to receive(:read_i64).ordered.exactly(9).times
+      expect(@prot).to receive(:read_set_end)
       real_skip.call(Thrift::Types::SET)
     end
 
     it "should skip lists" do
       real_skip = @prot.method(:skip)
-      @prot.should_receive(:read_list_begin).ordered.and_return([Thrift::Types::DOUBLE, 11])
-      @prot.should_receive(:read_double).ordered.exactly(11).times
-      @prot.should_receive(:read_list_end)
+      expect(@prot).to receive(:read_list_begin).ordered.and_return([Thrift::Types::DOUBLE, 11])
+      expect(@prot).to receive(:read_double).ordered.exactly(11).times
+      expect(@prot).to receive(:read_list_end)
       real_skip.call(Thrift::Types::LIST)
     end
   end
@@ -216,11 +216,11 @@ describe 'BaseProtocol' do
   describe Thrift::BaseProtocolFactory do
     it "should raise NotImplementedError" do
       # returning nil since Protocol is just an abstract class
-      lambda {Thrift::BaseProtocolFactory.new.get_protocol(mock("MockTransport"))}.should raise_error(NotImplementedError)
+      expect {Thrift::BaseProtocolFactory.new.get_protocol(double("MockTransport"))}.to raise_error(NotImplementedError)
     end
 
     it "should provide a reasonable to_s" do
-      Thrift::BaseProtocolFactory.new.to_s.should == "base"
+      expect(Thrift::BaseProtocolFactory.new.to_s).to eq("base")
     end
   end
 end

http://git-wip-us.apache.org/repos/asf/thrift/blob/27247079/lib/rb/spec/base_transport_spec.rb
----------------------------------------------------------------------
diff --git a/lib/rb/spec/base_transport_spec.rb b/lib/rb/spec/base_transport_spec.rb
index 0a05df2..d2f60aa 100644
--- a/lib/rb/spec/base_transport_spec.rb
+++ b/lib/rb/spec/base_transport_spec.rb
@@ -24,119 +24,119 @@ describe 'BaseTransport' do
   describe Thrift::TransportException do
     it "should make type accessible" do
       exc = Thrift::TransportException.new(Thrift::TransportException::ALREADY_OPEN, "msg")
-      exc.type.should == Thrift::TransportException::ALREADY_OPEN
-      exc.message.should == "msg"
+      expect(exc.type).to eq(Thrift::TransportException::ALREADY_OPEN)
+      expect(exc.message).to eq("msg")
     end
   end
 
   describe Thrift::BaseTransport do
     it "should read the specified size" do
       transport = Thrift::BaseTransport.new
-      transport.should_receive(:read).with(40).ordered.and_return("10 letters")
-      transport.should_receive(:read).with(30).ordered.and_return("fifteen letters")
-      transport.should_receive(:read).with(15).ordered.and_return("more characters")
-      transport.read_all(40).should == "10 lettersfifteen lettersmore characters"
+      expect(transport).to receive(:read).with(40).ordered.and_return("10 letters")
+      expect(transport).to receive(:read).with(30).ordered.and_return("fifteen letters")
+      expect(transport).to receive(:read).with(15).ordered.and_return("more characters")
+      expect(transport.read_all(40)).to eq("10 lettersfifteen lettersmore characters")
     end
 
     it "should stub out the rest of the methods" do
       # can't test for stubbiness, so just make sure they're defined
       [:open?, :open, :close, :read, :write, :flush].each do |sym|
-        Thrift::BaseTransport.method_defined?(sym).should be_true
+        expect(Thrift::BaseTransport.method_defined?(sym)).to be_truthy
       end
     end
 
     it "should alias << to write" do
-      Thrift::BaseTransport.instance_method(:<<).should == Thrift::BaseTransport.instance_method(:write)
+      expect(Thrift::BaseTransport.instance_method(:<<)).to eq(Thrift::BaseTransport.instance_method(:write))
     end
     
     it "should provide a reasonable to_s" do
-      Thrift::BaseTransport.new.to_s.should == "base"
+      expect(Thrift::BaseTransport.new.to_s).to eq("base")
     end
   end
 
   describe Thrift::BaseServerTransport do
     it "should stub out its methods" do
       [:listen, :accept, :close].each do |sym|
-        Thrift::BaseServerTransport.method_defined?(sym).should be_true
+        expect(Thrift::BaseServerTransport.method_defined?(sym)).to be_truthy
       end
     end
   end
 
   describe Thrift::BaseTransportFactory do
     it "should return the transport it's given" do
-      transport = mock("Transport")
-      Thrift::BaseTransportFactory.new.get_transport(transport).should eql(transport)
+      transport = double("Transport")
+      expect(Thrift::BaseTransportFactory.new.get_transport(transport)).to eql(transport)
     end
     
     it "should provide a reasonable to_s" do
-      Thrift::BaseTransportFactory.new.to_s.should == "base"
+      expect(Thrift::BaseTransportFactory.new.to_s).to eq("base")
     end
   end
 
   describe Thrift::BufferedTransport do
     it "should provide a to_s that describes the encapsulation" do
-      trans = mock("Transport")
-      trans.should_receive(:to_s).and_return("mock")
-      Thrift::BufferedTransport.new(trans).to_s.should == "buffered(mock)"
+      trans = double("Transport")
+      expect(trans).to receive(:to_s).and_return("mock")
+      expect(Thrift::BufferedTransport.new(trans).to_s).to eq("buffered(mock)")
     end
 
     it "should pass through everything but write/flush/read" do
-      trans = mock("Transport")
-      trans.should_receive(:open?).ordered.and_return("+ open?")
-      trans.should_receive(:open).ordered.and_return("+ open")
-      trans.should_receive(:flush).ordered # from the close
-      trans.should_receive(:close).ordered.and_return("+ close")
+      trans = double("Transport")
+      expect(trans).to receive(:open?).ordered.and_return("+ open?")
+      expect(trans).to receive(:open).ordered.and_return("+ open")
+      expect(trans).to receive(:flush).ordered # from the close
+      expect(trans).to receive(:close).ordered.and_return("+ close")
       btrans = Thrift::BufferedTransport.new(trans)
-      btrans.open?.should == "+ open?"
-      btrans.open.should == "+ open"
-      btrans.close.should == "+ close"
+      expect(btrans.open?).to eq("+ open?")
+      expect(btrans.open).to eq("+ open")
+      expect(btrans.close).to eq("+ close")
     end
 
     it "should buffer reads in chunks of #{Thrift::BufferedTransport::DEFAULT_BUFFER}" do
-      trans = mock("Transport")
-      trans.should_receive(:read).with(Thrift::BufferedTransport::DEFAULT_BUFFER).and_return("lorum ipsum dolor emet")
+      trans = double("Transport")
+      expect(trans).to receive(:read).with(Thrift::BufferedTransport::DEFAULT_BUFFER).and_return("lorum ipsum dolor emet")
       btrans = Thrift::BufferedTransport.new(trans)
-      btrans.read(6).should == "lorum "
-      btrans.read(6).should == "ipsum "
-      btrans.read(6).should == "dolor "
-      btrans.read(6).should == "emet"
+      expect(btrans.read(6)).to eq("lorum ")
+      expect(btrans.read(6)).to eq("ipsum ")
+      expect(btrans.read(6)).to eq("dolor ")
+      expect(btrans.read(6)).to eq("emet")
     end
 
     it "should buffer writes and send them on flush" do
-      trans = mock("Transport")
+      trans = double("Transport")
       btrans = Thrift::BufferedTransport.new(trans)
       btrans.write("one/")
       btrans.write("two/")
       btrans.write("three/")
-      trans.should_receive(:write).with("one/two/three/").ordered
-      trans.should_receive(:flush).ordered
+      expect(trans).to receive(:write).with("one/two/three/").ordered
+      expect(trans).to receive(:flush).ordered
       btrans.flush
     end
 
     it "should only send buffered data once" do
-      trans = mock("Transport")
+      trans = double("Transport")
       btrans = Thrift::BufferedTransport.new(trans)
       btrans.write("one/")
       btrans.write("two/")
       btrans.write("three/")
-      trans.should_receive(:write).with("one/two/three/")
-      trans.stub!(:flush)
+      expect(trans).to receive(:write).with("one/two/three/")
+      allow(trans).to receive(:flush)
       btrans.flush
       # Nothing to flush with no data
       btrans.flush
     end
 
     it "should flush on close" do
-      trans = mock("Transport")
-      trans.should_receive(:close)
+      trans = double("Transport")
+      expect(trans).to receive(:close)
       btrans = Thrift::BufferedTransport.new(trans)
-      btrans.should_receive(:flush)
+      expect(btrans).to receive(:flush)
       btrans.close
     end
 
     it "should not write to socket if there's no data" do
-      trans = mock("Transport")
-      trans.should_receive(:flush)
+      trans = double("Transport")
+      expect(trans).to receive(:flush)
       btrans = Thrift::BufferedTransport.new(trans)
       btrans.flush
     end
@@ -144,90 +144,90 @@ describe 'BaseTransport' do
 
   describe Thrift::BufferedTransportFactory do
     it "should wrap the given transport in a BufferedTransport" do
-      trans = mock("Transport")
-      btrans = mock("BufferedTransport")
-      Thrift::BufferedTransport.should_receive(:new).with(trans).and_return(btrans)
-      Thrift::BufferedTransportFactory.new.get_transport(trans).should == btrans
+      trans = double("Transport")
+      btrans = double("BufferedTransport")
+      expect(Thrift::BufferedTransport).to receive(:new).with(trans).and_return(btrans)
+      expect(Thrift::BufferedTransportFactory.new.get_transport(trans)).to eq(btrans)
     end
     
     it "should provide a reasonable to_s" do
-      Thrift::BufferedTransportFactory.new.to_s.should == "buffered"
+      expect(Thrift::BufferedTransportFactory.new.to_s).to eq("buffered")
     end
   end
 
   describe Thrift::FramedTransport do
     before(:each) do
-      @trans = mock("Transport")
+      @trans = double("Transport")
     end
 
     it "should provide a to_s that describes the encapsulation" do
-      trans = mock("Transport")
-      trans.should_receive(:to_s).and_return("mock")
-      Thrift::FramedTransport.new(trans).to_s.should == "framed(mock)"
+      trans = double("Transport")
+      expect(trans).to receive(:to_s).and_return("mock")
+      expect(Thrift::FramedTransport.new(trans).to_s).to eq("framed(mock)")
     end
 
     it "should pass through open?/open/close" do
       ftrans = Thrift::FramedTransport.new(@trans)
-      @trans.should_receive(:open?).ordered.and_return("+ open?")
-      @trans.should_receive(:open).ordered.and_return("+ open")
-      @trans.should_receive(:close).ordered.and_return("+ close")
-      ftrans.open?.should == "+ open?"
-      ftrans.open.should == "+ open"
-      ftrans.close.should == "+ close"
+      expect(@trans).to receive(:open?).ordered.and_return("+ open?")
+      expect(@trans).to receive(:open).ordered.and_return("+ open")
+      expect(@trans).to receive(:close).ordered.and_return("+ close")
+      expect(ftrans.open?).to eq("+ open?")
+      expect(ftrans.open).to eq("+ open")
+      expect(ftrans.close).to eq("+ close")
     end
 
     it "should pass through read when read is turned off" do
       ftrans = Thrift::FramedTransport.new(@trans, false, true)
-      @trans.should_receive(:read).with(17).ordered.and_return("+ read")
-      ftrans.read(17).should == "+ read"
+      expect(@trans).to receive(:read).with(17).ordered.and_return("+ read")
+      expect(ftrans.read(17)).to eq("+ read")
     end
 
     it "should pass through write/flush when write is turned off" do
       ftrans = Thrift::FramedTransport.new(@trans, true, false)
-      @trans.should_receive(:write).with("foo").ordered.and_return("+ write")
-      @trans.should_receive(:flush).ordered.and_return("+ flush")
-      ftrans.write("foo").should == "+ write"
-      ftrans.flush.should == "+ flush"
+      expect(@trans).to receive(:write).with("foo").ordered.and_return("+ write")
+      expect(@trans).to receive(:flush).ordered.and_return("+ flush")
+      expect(ftrans.write("foo")).to eq("+ write")
+      expect(ftrans.flush).to eq("+ flush")
     end
 
     it "should return a full frame if asked for >= the frame's length" do
       frame = "this is a frame"
-      @trans.should_receive(:read_all).with(4).and_return("\000\000\000\017")
-      @trans.should_receive(:read_all).with(frame.length).and_return(frame)
-      Thrift::FramedTransport.new(@trans).read(frame.length + 10).should == frame
+      expect(@trans).to receive(:read_all).with(4).and_return("\000\000\000\017")
+      expect(@trans).to receive(:read_all).with(frame.length).and_return(frame)
+      expect(Thrift::FramedTransport.new(@trans).read(frame.length + 10)).to eq(frame)
     end
 
     it "should return slices of the frame when asked for < the frame's length" do
       frame = "this is a frame"
-      @trans.should_receive(:read_all).with(4).and_return("\000\000\000\017")
-      @trans.should_receive(:read_all).with(frame.length).and_return(frame)
+      expect(@trans).to receive(:read_all).with(4).and_return("\000\000\000\017")
+      expect(@trans).to receive(:read_all).with(frame.length).and_return(frame)
       ftrans = Thrift::FramedTransport.new(@trans)
-      ftrans.read(4).should == "this"
-      ftrans.read(4).should == " is "
-      ftrans.read(16).should == "a frame"
+      expect(ftrans.read(4)).to eq("this")
+      expect(ftrans.read(4)).to eq(" is ")
+      expect(ftrans.read(16)).to eq("a frame")
     end
 
     it "should return nothing if asked for <= 0" do
-      Thrift::FramedTransport.new(@trans).read(-2).should == ""
+      expect(Thrift::FramedTransport.new(@trans).read(-2)).to eq("")
     end
 
     it "should pull a new frame when the first is exhausted" do
       frame = "this is a frame"
       frame2 = "yet another frame"
-      @trans.should_receive(:read_all).with(4).and_return("\000\000\000\017", "\000\000\000\021")
-      @trans.should_receive(:read_all).with(frame.length).and_return(frame)
-      @trans.should_receive(:read_all).with(frame2.length).and_return(frame2)
+      expect(@trans).to receive(:read_all).with(4).and_return("\000\000\000\017", "\000\000\000\021")
+      expect(@trans).to receive(:read_all).with(frame.length).and_return(frame)
+      expect(@trans).to receive(:read_all).with(frame2.length).and_return(frame2)
       ftrans = Thrift::FramedTransport.new(@trans)
-      ftrans.read(4).should == "this"
-      ftrans.read(8).should == " is a fr"
-      ftrans.read(6).should == "ame"
-      ftrans.read(4).should == "yet "
-      ftrans.read(16).should == "another frame"
+      expect(ftrans.read(4)).to eq("this")
+      expect(ftrans.read(8)).to eq(" is a fr")
+      expect(ftrans.read(6)).to eq("ame")
+      expect(ftrans.read(4)).to eq("yet ")
+      expect(ftrans.read(16)).to eq("another frame")
     end
 
     it "should buffer writes" do
       ftrans = Thrift::FramedTransport.new(@trans)
-      @trans.should_not_receive(:write)
+      expect(@trans).not_to receive(:write)
       ftrans.write("foo")
       ftrans.write("bar")
       ftrans.write("this is a frame")
@@ -237,15 +237,15 @@ describe 'BaseTransport' do
       ftrans = Thrift::FramedTransport.new(@trans)
       ftrans.write("foobar", 3)
       ftrans.write("barfoo", 1)
-      @trans.stub!(:flush)
-      @trans.should_receive(:write).with("\000\000\000\004foob")
+      allow(@trans).to receive(:flush)
+      expect(@trans).to receive(:write).with("\000\000\000\004foob")
       ftrans.flush
     end
 
     it "should flush frames with a 4-byte header" do
       ftrans = Thrift::FramedTransport.new(@trans)
-      @trans.should_receive(:write).with("\000\000\000\035one/two/three/this is a frame").ordered
-      @trans.should_receive(:flush).ordered
+      expect(@trans).to receive(:write).with("\000\000\000\035one/two/three/this is a frame").ordered
+      expect(@trans).to receive(:flush).ordered
       ftrans.write("one/")
       ftrans.write("two/")
       ftrans.write("three/")
@@ -255,25 +255,25 @@ describe 'BaseTransport' do
 
     it "should not flush the same buffered data twice" do
       ftrans = Thrift::FramedTransport.new(@trans)
-      @trans.should_receive(:write).with("\000\000\000\007foo/bar")
-      @trans.stub!(:flush)
+      expect(@trans).to receive(:write).with("\000\000\000\007foo/bar")
+      allow(@trans).to receive(:flush)
       ftrans.write("foo")
       ftrans.write("/bar")
       ftrans.flush
-      @trans.should_receive(:write).with("\000\000\000\000")
+      expect(@trans).to receive(:write).with("\000\000\000\000")
       ftrans.flush
     end
   end
 
   describe Thrift::FramedTransportFactory do
     it "should wrap the given transport in a FramedTransport" do
-      trans = mock("Transport")
-      Thrift::FramedTransport.should_receive(:new).with(trans)
+      trans = double("Transport")
+      expect(Thrift::FramedTransport).to receive(:new).with(trans)
       Thrift::FramedTransportFactory.new.get_transport(trans)
     end
     
     it "should provide a reasonable to_s" do
-      Thrift::FramedTransportFactory.new.to_s.should == "framed"
+      expect(Thrift::FramedTransportFactory.new.to_s).to eq("framed")
     end
   end
 
@@ -283,105 +283,105 @@ describe 'BaseTransport' do
     end
 
     it "should provide a reasonable to_s" do
-      @buffer.to_s.should == "memory"
+      expect(@buffer.to_s).to eq("memory")
     end
 
     it "should accept a buffer on input and use it directly" do
       s = "this is a test"
       @buffer = Thrift::MemoryBufferTransport.new(s)
-      @buffer.read(4).should == "this"
+      expect(@buffer.read(4)).to eq("this")
       s.slice!(-4..-1)
-      @buffer.read(@buffer.available).should == " is a "
+      expect(@buffer.read(@buffer.available)).to eq(" is a ")
     end
 
     it "should always remain open" do
-      @buffer.should be_open
+      expect(@buffer).to be_open
       @buffer.close
-      @buffer.should be_open
+      expect(@buffer).to be_open
     end
 
     it "should respond to peek and available" do
       @buffer.write "some data"
-      @buffer.peek.should be_true
-      @buffer.available.should == 9
+      expect(@buffer.peek).to be_truthy
+      expect(@buffer.available).to eq(9)
       @buffer.read(4)
-      @buffer.peek.should be_true
-      @buffer.available.should == 5
+      expect(@buffer.peek).to be_truthy
+      expect(@buffer.available).to eq(5)
       @buffer.read(5)
-      @buffer.peek.should be_false
-      @buffer.available.should == 0
+      expect(@buffer.peek).to be_falsey
+      expect(@buffer.available).to eq(0)
     end
 
     it "should be able to reset the buffer" do
       @buffer.write "test data"
       @buffer.reset_buffer("foobar")
-      @buffer.available.should == 6
-      @buffer.read(@buffer.available).should == "foobar"
+      expect(@buffer.available).to eq(6)
+      expect(@buffer.read(@buffer.available)).to eq("foobar")
       @buffer.reset_buffer
-      @buffer.available.should == 0
+      expect(@buffer.available).to eq(0)
     end
 
     it "should copy the given string when resetting the buffer" do
       s = "this is a test"
       @buffer.reset_buffer(s)
-      @buffer.available.should == 14
+      expect(@buffer.available).to eq(14)
       @buffer.read(10)
-      @buffer.available.should == 4
-      s.should == "this is a test"
+      expect(@buffer.available).to eq(4)
+      expect(s).to eq("this is a test")
     end
 
     it "should return from read what was given in write" do
       @buffer.write "test data"
-      @buffer.read(4).should == "test"
-      @buffer.read(@buffer.available).should == " data"
+      expect(@buffer.read(4)).to eq("test")
+      expect(@buffer.read(@buffer.available)).to eq(" data")
       @buffer.write "foo"
       @buffer.write " bar"
-      @buffer.read(@buffer.available).should == "foo bar"
+      expect(@buffer.read(@buffer.available)).to eq("foo bar")
     end
 
     it "should throw an EOFError when there isn't enough data in the buffer" do
       @buffer.reset_buffer("")
-      lambda{@buffer.read(1)}.should raise_error(EOFError)
+      expect{@buffer.read(1)}.to raise_error(EOFError)
 
       @buffer.reset_buffer("1234")
-      lambda{@buffer.read(5)}.should raise_error(EOFError)
+      expect{@buffer.read(5)}.to raise_error(EOFError)
     end
   end
 
   describe Thrift::IOStreamTransport do
     before(:each) do
-      @input = mock("Input", :closed? => false)
-      @output = mock("Output", :closed? => false)
+      @input = double("Input", :closed? => false)
+      @output = double("Output", :closed? => false)
       @trans = Thrift::IOStreamTransport.new(@input, @output)
     end
 
     it "should provide a reasonable to_s" do
-      @input.should_receive(:to_s).and_return("mock_input")
-      @output.should_receive(:to_s).and_return("mock_output")
-      @trans.to_s.should == "iostream(input=mock_input,output=mock_output)"
+      expect(@input).to receive(:to_s).and_return("mock_input")
+      expect(@output).to receive(:to_s).and_return("mock_output")
+      expect(@trans.to_s).to eq("iostream(input=mock_input,output=mock_output)")
     end
 
     it "should be open as long as both input or output are open" do
-      @trans.should be_open
-      @input.stub!(:closed?).and_return(true)
-      @trans.should be_open
-      @input.stub!(:closed?).and_return(false)
-      @output.stub!(:closed?).and_return(true)
-      @trans.should be_open
-      @input.stub!(:closed?).and_return(true)
-      @trans.should_not be_open
+      expect(@trans).to be_open
+      allow(@input).to receive(:closed?).and_return(true)
+      expect(@trans).to be_open
+      allow(@input).to receive(:closed?).and_return(false)
+      allow(@output).to receive(:closed?).and_return(true)
+      expect(@trans).to be_open
+      allow(@input).to receive(:closed?).and_return(true)
+      expect(@trans).not_to be_open
     end
 
     it "should pass through read/write to input/output" do
-      @input.should_receive(:read).with(17).and_return("+ read")
-      @output.should_receive(:write).with("foobar").and_return("+ write")
-      @trans.read(17).should == "+ read"
-      @trans.write("foobar").should == "+ write"
+      expect(@input).to receive(:read).with(17).and_return("+ read")
+      expect(@output).to receive(:write).with("foobar").and_return("+ write")
+      expect(@trans.read(17)).to eq("+ read")
+      expect(@trans.write("foobar")).to eq("+ write")
     end
 
     it "should close both input and output when closed" do
-      @input.should_receive(:close)
-      @output.should_receive(:close)
+      expect(@input).to receive(:close)
+      expect(@output).to receive(:close)
       @trans.close
     end
   end

http://git-wip-us.apache.org/repos/asf/thrift/blob/27247079/lib/rb/spec/binary_protocol_accelerated_spec.rb
----------------------------------------------------------------------
diff --git a/lib/rb/spec/binary_protocol_accelerated_spec.rb b/lib/rb/spec/binary_protocol_accelerated_spec.rb
index d49404a..b2cd04b 100644
--- a/lib/rb/spec/binary_protocol_accelerated_spec.rb
+++ b/lib/rb/spec/binary_protocol_accelerated_spec.rb
@@ -33,11 +33,11 @@ if defined? Thrift::BinaryProtocolAccelerated
 
     describe Thrift::BinaryProtocolAcceleratedFactory do
       it "should create a BinaryProtocolAccelerated" do
-        Thrift::BinaryProtocolAcceleratedFactory.new.get_protocol(mock("MockTransport")).should be_instance_of(Thrift::BinaryProtocolAccelerated)
+        expect(Thrift::BinaryProtocolAcceleratedFactory.new.get_protocol(double("MockTransport"))).to be_instance_of(Thrift::BinaryProtocolAccelerated)
       end
 
       it "should provide a reasonable to_s" do
-        Thrift::BinaryProtocolAcceleratedFactory.new.to_s.should == "binary-accel"
+        expect(Thrift::BinaryProtocolAcceleratedFactory.new.to_s).to eq("binary-accel")
       end
     end
   end

http://git-wip-us.apache.org/repos/asf/thrift/blob/27247079/lib/rb/spec/binary_protocol_spec.rb
----------------------------------------------------------------------
diff --git a/lib/rb/spec/binary_protocol_spec.rb b/lib/rb/spec/binary_protocol_spec.rb
index cccfc48..065f5ce 100644
--- a/lib/rb/spec/binary_protocol_spec.rb
+++ b/lib/rb/spec/binary_protocol_spec.rb
@@ -38,37 +38,37 @@ describe 'BinaryProtocol' do
     it "should read a message header" do
       @trans.write([protocol_class.const_get(:VERSION_1) | Thrift::MessageTypes::REPLY].pack('N'))
       @trans.write([42].pack('N'))
-      @prot.should_receive(:read_string).and_return('testMessage')
-      @prot.read_message_begin.should == ['testMessage', Thrift::MessageTypes::REPLY, 42]
+      expect(@prot).to receive(:read_string).and_return('testMessage')
+      expect(@prot.read_message_begin).to eq(['testMessage', Thrift::MessageTypes::REPLY, 42])
     end
 
     it "should raise an exception if the message header has the wrong version" do
-      @prot.should_receive(:read_i32).and_return(-1)
-      lambda { @prot.read_message_begin }.should raise_error(Thrift::ProtocolException, 'Missing version identifier') do |e|
+      expect(@prot).to receive(:read_i32).and_return(-1)
+      expect { @prot.read_message_begin }.to raise_error(Thrift::ProtocolException, 'Missing version identifier') do |e|
         e.type == Thrift::ProtocolException::BAD_VERSION
       end
     end
 
     it "should raise an exception if the message header does not exist and strict_read is enabled" do
-      @prot.should_receive(:read_i32).and_return(42)
-      @prot.should_receive(:strict_read).and_return(true)
-      lambda { @prot.read_message_begin }.should raise_error(Thrift::ProtocolException, 'No version identifier, old protocol client?') do |e|
+      expect(@prot).to receive(:read_i32).and_return(42)
+      expect(@prot).to receive(:strict_read).and_return(true)
+      expect { @prot.read_message_begin }.to raise_error(Thrift::ProtocolException, 'No version identifier, old protocol client?') do |e|
         e.type == Thrift::ProtocolException::BAD_VERSION
       end
     end
 
     it "should provide a reasonable to_s" do
-      @prot.to_s.should == "binary(memory)"
+      expect(@prot.to_s).to eq("binary(memory)")
     end
   end
 
   describe Thrift::BinaryProtocolFactory do
     it "should create a BinaryProtocol" do
-      Thrift::BinaryProtocolFactory.new.get_protocol(mock("MockTransport")).should be_instance_of(Thrift::BinaryProtocol)
+      expect(Thrift::BinaryProtocolFactory.new.get_protocol(double("MockTransport"))).to be_instance_of(Thrift::BinaryProtocol)
     end
 
     it "should provide a reasonable to_s" do
-      Thrift::BinaryProtocolFactory.new.to_s.should == "binary"
+      expect(Thrift::BinaryProtocolFactory.new.to_s).to eq("binary")
     end
   end
 end

http://git-wip-us.apache.org/repos/asf/thrift/blob/27247079/lib/rb/spec/binary_protocol_spec_shared.rb
----------------------------------------------------------------------
diff --git a/lib/rb/spec/binary_protocol_spec_shared.rb b/lib/rb/spec/binary_protocol_spec_shared.rb
index 7a9d028..58d65f0 100644
--- a/lib/rb/spec/binary_protocol_spec_shared.rb
+++ b/lib/rb/spec/binary_protocol_spec_shared.rb
@@ -27,34 +27,34 @@ shared_examples_for 'a binary protocol' do
   end
 
   it "should define the proper VERSION_1, VERSION_MASK AND TYPE_MASK" do
-    protocol_class.const_get(:VERSION_MASK).should == 0xffff0000
-    protocol_class.const_get(:VERSION_1).should == 0x80010000
-    protocol_class.const_get(:TYPE_MASK).should == 0x000000ff
+    expect(protocol_class.const_get(:VERSION_MASK)).to eq(0xffff0000)
+    expect(protocol_class.const_get(:VERSION_1)).to eq(0x80010000)
+    expect(protocol_class.const_get(:TYPE_MASK)).to eq(0x000000ff)
   end
 
   it "should make strict_read readable" do
-    @prot.strict_read.should eql(true)
+    expect(@prot.strict_read).to eql(true)
   end
 
   it "should make strict_write readable" do
-    @prot.strict_write.should eql(true)
+    expect(@prot.strict_write).to eql(true)
   end    
 
   it "should write the message header" do
     @prot.write_message_begin('testMessage', Thrift::MessageTypes::CALL, 17)
-    @trans.read(@trans.available).should == [protocol_class.const_get(:VERSION_1) | Thrift::MessageTypes::CALL, "testMessage".size, "testMessage", 17].pack("NNa11N")
+    expect(@trans.read(@trans.available)).to eq([protocol_class.const_get(:VERSION_1) | Thrift::MessageTypes::CALL, "testMessage".size, "testMessage", 17].pack("NNa11N"))
   end
   
   it "should write the message header without version when writes are not strict" do
     @prot = protocol_class.new(@trans, true, false) # no strict write
     @prot.write_message_begin('testMessage', Thrift::MessageTypes::CALL, 17)
-    @trans.read(@trans.available).should == "\000\000\000\vtestMessage\001\000\000\000\021"
+    expect(@trans.read(@trans.available)).to eq("\000\000\000\vtestMessage\001\000\000\000\021")
   end
   
   it "should write the message header with a version when writes are strict" do
     @prot = protocol_class.new(@trans) # strict write
     @prot.write_message_begin('testMessage', Thrift::MessageTypes::CALL, 17)
-    @trans.read(@trans.available).should == "\200\001\000\001\000\000\000\vtestMessage\000\000\000\021"
+    expect(@trans.read(@trans.available)).to eq("\200\001\000\001\000\000\000\vtestMessage\000\000\000\021")
   end
   
 
@@ -62,64 +62,67 @@ shared_examples_for 'a binary protocol' do
 
   it "should write the field header" do
     @prot.write_field_begin('foo', Thrift::Types::DOUBLE, 3)
-    @trans.read(@trans.available).should == [Thrift::Types::DOUBLE, 3].pack("cn")
+    expect(@trans.read(@trans.available)).to eq([Thrift::Types::DOUBLE, 3].pack("cn"))
   end
   
   # field footer is a noop
   
   it "should write the STOP field" do
     @prot.write_field_stop
-    @trans.read(1).should == "\000"
+    expect(@trans.read(1)).to eq("\000")
   end
   
   it "should write the map header" do
     @prot.write_map_begin(Thrift::Types::STRING, Thrift::Types::LIST, 17)
-    @trans.read(@trans.available).should == [Thrift::Types::STRING, Thrift::Types::LIST, 17].pack("ccN");
+    expect(@trans.read(@trans.available)).to eq([Thrift::Types::STRING, Thrift::Types::LIST, 17].pack("ccN"));
   end
    
   # map footer is a noop
   
   it "should write the list header" do
     @prot.write_list_begin(Thrift::Types::I16, 42)
-    @trans.read(@trans.available).should == [Thrift::Types::I16, 42].pack("cN")
+    expect(@trans.read(@trans.available)).to eq([Thrift::Types::I16, 42].pack("cN"))
   end
   
   # list footer is a noop
   
   it "should write the set header" do
     @prot.write_set_begin(Thrift::Types::I16, 42)
-    @trans.read(@trans.available).should == [Thrift::Types::I16, 42].pack("cN")
+    expect(@trans.read(@trans.available)).to eq([Thrift::Types::I16, 42].pack("cN"))
   end
   
   it "should write a bool" do
     @prot.write_bool(true)
     @prot.write_bool(false)
-    @trans.read(@trans.available).should == "\001\000"
+    expect(@trans.read(@trans.available)).to eq("\001\000")
   end
   
   it "should treat a nil bool as false" do
     @prot.write_bool(nil)
-    @trans.read(1).should == "\000"
+    expect(@trans.read(1)).to eq("\000")
   end
   
   it "should write a byte" do
     # byte is small enough, let's check -128..127
     (-128..127).each do |i|
       @prot.write_byte(i)
-      @trans.read(1).should == [i].pack('c')
+      expect(@trans.read(1)).to eq([i].pack('c'))
     end
-    # handing it numbers out of signed range should clip
-    @trans.rspec_verify
+  end
+
+  it "should clip numbers out of signed range" do
     (128..255).each do |i|
       @prot.write_byte(i)
-      @trans.read(1).should == [i].pack('c')
+      expect(@trans.read(1)).to eq([i].pack('c'))
     end
-    # and lastly, a Bignum is going to error out
-    lambda { @prot.write_byte(2**65) }.should raise_error(RangeError)
+  end
+
+  it "errors out with a Bignum" do
+    expect { @prot.write_byte(2**65) }.to raise_error(RangeError)
   end
   
   it "should error gracefully when trying to write a nil byte" do
-    lambda { @prot.write_byte(nil) }.should raise_error
+    expect { @prot.write_byte(nil) }.to raise_error
   end
   
   it "should write an i16" do
@@ -131,14 +134,14 @@ shared_examples_for 'a binary protocol' do
     # and try something out of signed range, it should clip
     @prot.write_i16(2**15 + 5)
     
-    @trans.read(@trans.available).should == "\200\000\374\000\000\021\000\000\330\360\006\273\177\377\200\005"
+    expect(@trans.read(@trans.available)).to eq("\200\000\374\000\000\021\000\000\330\360\006\273\177\377\200\005")
     
     # a Bignum should error
     # lambda { @prot.write_i16(2**65) }.should raise_error(RangeError)
   end
   
   it "should error gracefully when trying to write a nil i16" do
-    lambda { @prot.write_i16(nil) }.should raise_error
+    expect { @prot.write_i16(nil) }.to raise_error
   end
   
   it "should write an i32" do
@@ -148,14 +151,14 @@ shared_examples_for 'a binary protocol' do
       @prot.write_i32(i)
     end
     # try something out of signed range, it should clip
-    @trans.read(@trans.available).should == "\200\000\000\000" + "\377\376\037\r" + "\377\377\366\034" + "\377\377\377\375" + "\000\000\000\000" + "\000#\340\203" + "\000\0000+" + "\177\377\377\377"
+    expect(@trans.read(@trans.available)).to eq("\200\000\000\000" + "\377\376\037\r" + "\377\377\366\034" + "\377\377\377\375" + "\000\000\000\000" + "\000#\340\203" + "\000\0000+" + "\177\377\377\377")
     [2 ** 31 + 5, 2 ** 65 + 5].each do |i|
-      lambda { @prot.write_i32(i) }.should raise_error(RangeError)  
+      expect { @prot.write_i32(i) }.to raise_error(RangeError)  
     end
   end
   
   it "should error gracefully when trying to write a nil i32" do
-    lambda { @prot.write_i32(nil) }.should raise_error
+    expect { @prot.write_i32(nil) }.to raise_error
   end
   
   it "should write an i64" do
@@ -165,7 +168,7 @@ shared_examples_for 'a binary protocol' do
       @prot.write_i64(i)
     end
     # try something out of signed range, it should clip
-    @trans.read(@trans.available).should == ["\200\000\000\000\000\000\000\000",
+    expect(@trans.read(@trans.available)).to eq(["\200\000\000\000\000\000\000\000",
       "\377\377\364\303\035\244+]",
       "\377\377\377\377\376\231:\341",
       "\377\377\377\377\377\377\377\026",
@@ -173,12 +176,12 @@ shared_examples_for 'a binary protocol' do
       "\000\000\000\000\000\000\004\317",
       "\000\000\000\000\000#\340\204",
       "\000\000\000\002\340\311~\365",
-      "\177\377\377\377\377\377\377\377"].join("")
-    lambda { @prot.write_i64(2 ** 65 + 5) }.should raise_error(RangeError)
+      "\177\377\377\377\377\377\377\377"].join(""))
+    expect { @prot.write_i64(2 ** 65 + 5) }.to raise_error(RangeError)
   end
   
   it "should error gracefully when trying to write a nil i64" do
-    lambda { @prot.write_i64(nil) }.should raise_error
+    expect { @prot.write_i64(nil) }.to raise_error
   end
   
   it "should write a double" do
@@ -186,12 +189,12 @@ shared_examples_for 'a binary protocol' do
     values = [Float::MIN,-1231.15325, -123123.23, -23.23515123, 0, 12351.1325, 523.23, Float::MAX]
     values.each do |f|
       @prot.write_double(f)
-      @trans.read(@trans.available).should == [f].pack("G")
+      expect(@trans.read(@trans.available)).to eq([f].pack("G"))
     end
   end
   
   it "should error gracefully when trying to write a nil double" do
-    lambda { @prot.write_double(nil) }.should raise_error
+    expect { @prot.write_double(nil) }.to raise_error
   end
 
   if RUBY_VERSION >= '1.9'
@@ -199,111 +202,111 @@ shared_examples_for 'a binary protocol' do
       str = 'abc'
       @prot.write_string(str)
       a = @trans.read(@trans.available)
-      a.encoding.should == Encoding::BINARY
-      a.unpack('C*').should == [0x00, 0x00, 0x00, 0x03, 0x61, 0x62, 0x63]
+      expect(a.encoding).to eq(Encoding::BINARY)
+      expect(a.unpack('C*')).to eq([0x00, 0x00, 0x00, 0x03, 0x61, 0x62, 0x63])
     end
 
     it 'should write a string with unicode characters' do
       str = "abc \u20AC \u20AD".encode('UTF-8')
       @prot.write_string(str)
       a = @trans.read(@trans.available)
-      a.encoding.should == Encoding::BINARY
-      a.unpack('C*').should == [0x00, 0x00, 0x00, 0x0B, 0x61, 0x62, 0x63, 0x20,
-                                0xE2, 0x82, 0xAC, 0x20, 0xE2, 0x82, 0xAD]
+      expect(a.encoding).to eq(Encoding::BINARY)
+      expect(a.unpack('C*')).to eq([0x00, 0x00, 0x00, 0x0B, 0x61, 0x62, 0x63, 0x20,
+                                0xE2, 0x82, 0xAC, 0x20, 0xE2, 0x82, 0xAD])
     end
 
     it 'should write should write a string with unicode characters and transcoding' do
       str = "abc \u20AC".encode('ISO-8859-15')
       @prot.write_string(str)
       a = @trans.read(@trans.available)
-      a.encoding.should == Encoding::BINARY
-      a.unpack('C*').should == [0x00, 0x00, 0x00, 0x07, 0x61, 0x62, 0x63, 0x20, 0xE2, 0x82, 0xAC]
+      expect(a.encoding).to eq(Encoding::BINARY)
+      expect(a.unpack('C*')).to eq([0x00, 0x00, 0x00, 0x07, 0x61, 0x62, 0x63, 0x20, 0xE2, 0x82, 0xAC])
     end
 
     it 'should write a binary string' do
       buffer = [0, 1, 2, 3].pack('C*')
       @prot.write_binary(buffer)
       a = @trans.read(@trans.available)
-      a.encoding.should == Encoding::BINARY
-      a.unpack('C*').should == [0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x02, 0x03]
+      expect(a.encoding).to eq(Encoding::BINARY)
+      expect(a.unpack('C*')).to eq([0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x02, 0x03])
     end
   else
     it 'should write a string' do
       str = 'abc'
       @prot.write_string(str)
       a = @trans.read(@trans.available)
-      a.unpack('C*').should == [0x00, 0x00, 0x00, 0x03, 0x61, 0x62, 0x63]
+      expect(a.unpack('C*')).to eq([0x00, 0x00, 0x00, 0x03, 0x61, 0x62, 0x63])
     end
 
     it 'should write a binary string' do
       buffer = [0, 1, 2, 3].pack('C*')
       @prot.write_binary(buffer)
       a = @trans.read(@trans.available)
-      a.unpack('C*').should == [0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x02, 0x03]
+      expect(a.unpack('C*')).to eq([0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x02, 0x03])
     end
   end
 
   it "should error gracefully when trying to write a nil string" do
-    lambda { @prot.write_string(nil) }.should raise_error
+    expect { @prot.write_string(nil) }.to raise_error
   end
   
   it "should write the message header without version when writes are not strict" do
     @prot = protocol_class.new(@trans, true, false) # no strict write
     @prot.write_message_begin('testMessage', Thrift::MessageTypes::CALL, 17)
-    @trans.read(@trans.available).should == "\000\000\000\vtestMessage\001\000\000\000\021"
+    expect(@trans.read(@trans.available)).to eq("\000\000\000\vtestMessage\001\000\000\000\021")
   end
     
   it "should write the message header with a version when writes are strict" do
     @prot = protocol_class.new(@trans) # strict write
     @prot.write_message_begin('testMessage', Thrift::MessageTypes::CALL, 17)
-    @trans.read(@trans.available).should == "\200\001\000\001\000\000\000\vtestMessage\000\000\000\021"
+    expect(@trans.read(@trans.available)).to eq("\200\001\000\001\000\000\000\vtestMessage\000\000\000\021")
   end
   
   # message footer is a noop
   
   it "should read a field header" do
     @trans.write([Thrift::Types::STRING, 3].pack("cn"))
-    @prot.read_field_begin.should == [nil, Thrift::Types::STRING, 3]
+    expect(@prot.read_field_begin).to eq([nil, Thrift::Types::STRING, 3])
   end
   
   # field footer is a noop
   
   it "should read a stop field" do
     @trans.write([Thrift::Types::STOP].pack("c"));
-    @prot.read_field_begin.should == [nil, Thrift::Types::STOP, 0]
+    expect(@prot.read_field_begin).to eq([nil, Thrift::Types::STOP, 0])
   end
 
   it "should read a map header" do
     @trans.write([Thrift::Types::DOUBLE, Thrift::Types::I64, 42].pack("ccN"))
-    @prot.read_map_begin.should == [Thrift::Types::DOUBLE, Thrift::Types::I64, 42]
+    expect(@prot.read_map_begin).to eq([Thrift::Types::DOUBLE, Thrift::Types::I64, 42])
   end
   
   # map footer is a noop
   
   it "should read a list header" do
     @trans.write([Thrift::Types::STRING, 17].pack("cN"))
-    @prot.read_list_begin.should == [Thrift::Types::STRING, 17]
+    expect(@prot.read_list_begin).to eq([Thrift::Types::STRING, 17])
   end
   
   # list footer is a noop
   
   it "should read a set header" do
     @trans.write([Thrift::Types::STRING, 17].pack("cN"))
-    @prot.read_set_begin.should == [Thrift::Types::STRING, 17]
+    expect(@prot.read_set_begin).to eq([Thrift::Types::STRING, 17])
   end
   
   # set footer is a noop
   
   it "should read a bool" do
     @trans.write("\001\000");
-    @prot.read_bool.should == true
-    @prot.read_bool.should == false
+    expect(@prot.read_bool).to eq(true)
+    expect(@prot.read_bool).to eq(false)
   end
   
   it "should read a byte" do
     [-128, -57, -3, 0, 17, 24, 127].each do |i|
       @trans.write([i].pack("c"))
-      @prot.read_byte.should == i
+      expect(@prot.read_byte).to eq(i)
     end
   end
   
@@ -311,7 +314,7 @@ shared_examples_for 'a binary protocol' do
     # try a scattering of values, including min/max
     [-2**15, -5237, -353, 0, 1527, 2234, 2**15-1].each do |i|
       @trans.write([i].pack("n"));
-      @prot.read_i16.should == i
+      expect(@prot.read_i16).to eq(i)
     end
   end
   
@@ -319,7 +322,7 @@ shared_examples_for 'a binary protocol' do
     # try a scattering of values, including min/max
     [-2**31, -235125, -6236, 0, 2351, 123123, 2**31-1].each do |i|
       @trans.write([i].pack("N"))
-      @prot.read_i32.should == i
+      expect(@prot.read_i32).to eq(i)
     end
   end
   
@@ -327,7 +330,7 @@ shared_examples_for 'a binary protocol' do
     # try a scattering of values, including min/max
     [-2**63, -123512312, -6346, 0, 32, 2346322323, 2**63-1].each do |i|
       @trans.write([i >> 32, i & 0xFFFFFFFF].pack("NN"))
-      @prot.read_i64.should == i
+      expect(@prot.read_i64).to eq(i)
     end
   end
   
@@ -335,7 +338,7 @@ shared_examples_for 'a binary protocol' do
     # try a random scattering of values, including min/max
     [Float::MIN, -231231.12351, -323.233513, 0, 123.2351235, 2351235.12351235, Float::MAX].each do |f|
       @trans.write([f].pack("G"));
-      @prot.read_double.should == f
+      expect(@prot.read_double).to eq(f)
     end
   end
 
@@ -345,8 +348,8 @@ shared_examples_for 'a binary protocol' do
       buffer = [0x00, 0x00, 0x00, 0x03, 0x61, 0x62, 0x63].pack('C*')
       @trans.write(buffer)
       a = @prot.read_string
-      a.should == 'abc'.encode('UTF-8')
-      a.encoding.should == Encoding::UTF_8
+      expect(a).to eq('abc'.encode('UTF-8'))
+      expect(a.encoding).to eq(Encoding::UTF_8)
     end
 
     it 'should read a string containing unicode characters from UTF-8 encoded buffer' do
@@ -354,44 +357,44 @@ shared_examples_for 'a binary protocol' do
       buffer = [0x00, 0x00, 0x00, 0x03, 0xE2, 0x82, 0xAC].pack('C*')
       @trans.write(buffer)
       a = @prot.read_string
-      a.should == "\u20AC".encode('UTF-8')
-      a.encoding.should == Encoding::UTF_8
+      expect(a).to eq("\u20AC".encode('UTF-8'))
+      expect(a.encoding).to eq(Encoding::UTF_8)
     end
 
     it 'should read a binary string' do
       buffer = [0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x02, 0x03].pack('C*')
       @trans.write(buffer)
       a = @prot.read_binary
-      a.should == [0x00, 0x01, 0x02, 0x03].pack('C*')
-      a.encoding.should == Encoding::BINARY
+      expect(a).to eq([0x00, 0x01, 0x02, 0x03].pack('C*'))
+      expect(a.encoding).to eq(Encoding::BINARY)
     end
   else
     it 'should read a string' do
       # i32 of value 3, followed by three characters/UTF-8 bytes 'a', 'b', 'c'
       buffer = [0x00, 0x00, 0x00, 0x03, 0x61, 0x62, 0x63].pack('C*')
       @trans.write(buffer)
-      @prot.read_string.should == 'abc'
+      expect(@prot.read_string).to eq('abc')
     end
 
     it 'should read a binary string' do
       buffer = [0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x02, 0x03].pack('C*')
       @trans.write(buffer)
       a = @prot.read_binary
-      a.should == [0x00, 0x01, 0x02, 0x03].pack('C*')
+      expect(a).to eq([0x00, 0x01, 0x02, 0x03].pack('C*'))
     end
   end
 
   it "should perform a complete rpc with no args or return" do
     srv_test(
       proc {|client| client.send_voidMethod()},
-      proc {|client| client.recv_voidMethod.should == nil}
+      proc {|client| expect(client.recv_voidMethod).to eq(nil)}
     )
   end
 
   it "should perform a complete rpc with a primitive return type" do
     srv_test(
       proc {|client| client.send_primitiveMethod()},
-      proc {|client| client.recv_primitiveMethod.should == 1}
+      proc {|client| expect(client.recv_primitiveMethod).to eq(1)}
     )
   end
 
@@ -402,7 +405,7 @@ shared_examples_for 'a binary protocol' do
         result = client.recv_structMethod
         result.set_byte_map = nil
         result.map_byte_map = nil
-        result.should == Fixtures::COMPACT_PROTOCOL_TEST_STRUCT
+        expect(result).to eq(Fixtures::COMPACT_PROTOCOL_TEST_STRUCT)
       }
     )
   end

http://git-wip-us.apache.org/repos/asf/thrift/blob/27247079/lib/rb/spec/bytes_spec.rb
----------------------------------------------------------------------
diff --git a/lib/rb/spec/bytes_spec.rb b/lib/rb/spec/bytes_spec.rb
index b82e304..2e8653c 100644
--- a/lib/rb/spec/bytes_spec.rb
+++ b/lib/rb/spec/bytes_spec.rb
@@ -25,33 +25,33 @@ describe Thrift::Bytes do
     describe '.empty_byte_buffer' do
       it 'should create an empty buffer' do
         b = Thrift::Bytes.empty_byte_buffer
-        b.length.should == 0
-        b.encoding.should == Encoding::BINARY
+        expect(b.length).to eq(0)
+        expect(b.encoding).to eq(Encoding::BINARY)
       end
 
       it 'should create an empty buffer of given size' do
         b = Thrift::Bytes.empty_byte_buffer 2
-        b.length.should == 2
-        b.getbyte(0).should == 0
-        b.getbyte(1).should == 0
-        b.encoding.should == Encoding::BINARY
+        expect(b.length).to eq(2)
+        expect(b.getbyte(0)).to eq(0)
+        expect(b.getbyte(1)).to eq(0)
+        expect(b.encoding).to eq(Encoding::BINARY)
       end
     end
 
     describe '.force_binary_encoding' do
       it 'should change encoding' do
         e = 'STRING'.encode('UTF-8')
-        e.encoding.should_not == Encoding::BINARY
+        expect(e.encoding).not_to eq(Encoding::BINARY)
         a = Thrift::Bytes.force_binary_encoding e
-        a.encoding.should == Encoding::BINARY
+        expect(a.encoding).to eq(Encoding::BINARY)
       end
     end
 
     describe '.get_string_byte' do
       it 'should get the byte at index' do
         s = "\x41\x42"
-        Thrift::Bytes.get_string_byte(s, 0).should == 0x41
-        Thrift::Bytes.get_string_byte(s, 1).should == 0x42
+        expect(Thrift::Bytes.get_string_byte(s, 0)).to eq(0x41)
+        expect(Thrift::Bytes.get_string_byte(s, 1)).to eq(0x42)
       end
     end
 
@@ -59,42 +59,42 @@ describe Thrift::Bytes do
       it 'should set byte value at index' do
         s = "\x41\x42"
         Thrift::Bytes.set_string_byte(s, 0, 0x43)
-        s.getbyte(0).should == 0x43
-        s.should == 'CB'
+        expect(s.getbyte(0)).to eq(0x43)
+        expect(s).to eq('CB')
       end
     end
 
     describe '.convert_to_utf8_byte_buffer' do
       it 'should convert UTF-8 String to byte buffer' do
         e = "\u20AC".encode('UTF-8') # a string with euro sign character U+20AC
-        e.length.should == 1
+        expect(e.length).to eq(1)
 
         a = Thrift::Bytes.convert_to_utf8_byte_buffer e
-        a.encoding.should == Encoding::BINARY
-        a.length.should == 3
-        a.unpack('C*').should == [0xE2, 0x82, 0xAC]
+        expect(a.encoding).to eq(Encoding::BINARY)
+        expect(a.length).to eq(3)
+        expect(a.unpack('C*')).to eq([0xE2, 0x82, 0xAC])
       end
 
       it 'should convert ISO-8859-15 String to UTF-8 byte buffer' do
         # Assumptions
         e = "\u20AC".encode('ISO-8859-15') # a string with euro sign character U+20AC, then converted to ISO-8859-15
-        e.length.should == 1
-        e.unpack('C*').should == [0xA4] # euro sign is a different code point in ISO-8859-15
+        expect(e.length).to eq(1)
+        expect(e.unpack('C*')).to eq([0xA4]) # euro sign is a different code point in ISO-8859-15
 
         a = Thrift::Bytes.convert_to_utf8_byte_buffer e
-        a.encoding.should == Encoding::BINARY
-        a.length.should == 3
-        a.unpack('C*').should == [0xE2, 0x82, 0xAC]
+        expect(a.encoding).to eq(Encoding::BINARY)
+        expect(a.length).to eq(3)
+        expect(a.unpack('C*')).to eq([0xE2, 0x82, 0xAC])
       end
     end
 
     describe '.convert_to_string' do
       it 'should convert UTF-8 byte buffer to a UTF-8 String' do
         e = [0xE2, 0x82, 0xAC].pack("C*")
-        e.encoding.should == Encoding::BINARY
+        expect(e.encoding).to eq(Encoding::BINARY)
         a = Thrift::Bytes.convert_to_string e
-        a.encoding.should == Encoding::UTF_8
-        a.should == "\u20AC"
+        expect(a.encoding).to eq(Encoding::UTF_8)
+        expect(a).to eq("\u20AC")
       end
     end
 
@@ -102,14 +102,14 @@ describe Thrift::Bytes do
     describe '.empty_byte_buffer' do
       it 'should create an empty buffer' do
         b = Thrift::Bytes.empty_byte_buffer
-        b.length.should == 0
+        expect(b.length).to eq(0)
       end
 
       it 'should create an empty buffer of given size' do
         b = Thrift::Bytes.empty_byte_buffer 2
-        b.length.should == 2
-        b[0].should == 0
-        b[1].should == 0
+        expect(b.length).to eq(2)
+        expect(b[0]).to eq(0)
+        expect(b[1]).to eq(0)
       end
     end
 
@@ -117,16 +117,16 @@ describe Thrift::Bytes do
       it 'should be a no-op' do
         e = 'STRING'
         a = Thrift::Bytes.force_binary_encoding e
-        a.should == e
-        a.should be(e)
+        expect(a).to eq(e)
+        expect(a).to be(e)
       end
     end
 
     describe '.get_string_byte' do
       it 'should get the byte at index' do
         s = "\x41\x42"
-        Thrift::Bytes.get_string_byte(s, 0).should == 0x41
-        Thrift::Bytes.get_string_byte(s, 1).should == 0x42
+        expect(Thrift::Bytes.get_string_byte(s, 0)).to eq(0x41)
+        expect(Thrift::Bytes.get_string_byte(s, 1)).to eq(0x42)
       end
     end
 
@@ -134,8 +134,8 @@ describe Thrift::Bytes do
       it 'should set byte value at index' do
         s = "\x41\x42"
         Thrift::Bytes.set_string_byte(s, 0, 0x43)
-        s[0].should == 0x43
-        s.should == 'CB'
+        expect(s[0]).to eq(0x43)
+        expect(s).to eq('CB')
       end
     end
 
@@ -143,8 +143,8 @@ describe Thrift::Bytes do
       it 'should be a no-op' do
         e = 'STRING'
         a = Thrift::Bytes.convert_to_utf8_byte_buffer e
-        a.should == e
-        a.should be(e)
+        expect(a).to eq(e)
+        expect(a).to be(e)
       end
     end
 
@@ -152,8 +152,8 @@ describe Thrift::Bytes do
       it 'should be a no-op' do
         e = 'STRING'
         a = Thrift::Bytes.convert_to_string e
-        a.should == e
-        a.should be(e)
+        expect(a).to eq(e)
+        expect(a).to be(e)
       end
     end
   end

http://git-wip-us.apache.org/repos/asf/thrift/blob/27247079/lib/rb/spec/client_spec.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 @@ describe 'Client' do
   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

http://git-wip-us.apache.org/repos/asf/thrift/blob/27247079/lib/rb/spec/compact_protocol_spec.rb
----------------------------------------------------------------------
diff --git a/lib/rb/spec/compact_protocol_spec.rb b/lib/rb/spec/compact_protocol_spec.rb
index 71ddc0e..513dd69 100644
--- a/lib/rb/spec/compact_protocol_spec.rb
+++ b/lib/rb/spec/compact_protocol_spec.rb
@@ -42,7 +42,7 @@ describe Thrift::CompactProtocol do
         proto.send(writer(primitive_type), value)
         # puts "buf: #{trans.inspect_buffer}" if primitive_type == :i64
         read_back = proto.send(reader(primitive_type))
-        read_back.should == value
+        expect(read_back).to eq(value)
       end
     end
   end
@@ -62,10 +62,10 @@ describe Thrift::CompactProtocol do
 
         proto = Thrift::CompactProtocol.new(trans)
         name, type, id = proto.read_field_begin
-        type.should == thrift_type
-        id.should == 15
+        expect(type).to eq(thrift_type)
+        expect(id).to eq(15)
         read_back = proto.send(reader(primitive_type))
-        read_back.should == value
+        expect(read_back).to eq(value)
         proto.read_field_end
       end
     end
@@ -81,7 +81,7 @@ describe Thrift::CompactProtocol do
 
     struct2 = Thrift::Test::CompactProtoTestStruct.new
     struct2.read(proto)    
-    struct2.should == struct
+    expect(struct2).to eq(struct)
   end
 
   it "should make method calls correctly" do
@@ -97,7 +97,7 @@ describe Thrift::CompactProtocol do
     client.send_Janky(1)
     # puts client_out_trans.inspect_buffer
     processor.process(client_out_proto, client_in_proto)
-    client.recv_Janky.should == 2
+    expect(client.recv_Janky).to eq(2)
   end
   
   it "should deal with fields following fields that have non-delta ids" do
@@ -113,7 +113,7 @@ describe Thrift::CompactProtocol do
     deser = Thrift::Deserializer.new(Thrift::CompactProtocolFactory.new)
     brcp2 = Thrift::Test::BreaksRubyCompactProtocol.new
     deser.deserialize(brcp2, bytes)
-    brcp2.should == brcp
+    expect(brcp2).to eq(brcp)
   end
   
   it "should deserialize an empty map to an empty hash" do
@@ -124,12 +124,12 @@ describe Thrift::CompactProtocol do
     deser = Thrift::Deserializer.new(Thrift::CompactProtocolFactory.new)
     struct2 = Thrift::Test::SingleMapTestStruct.new
     deser.deserialize(struct2, bytes)
-    struct.should == struct2
+    expect(struct).to eq(struct2)
   end
   
   it "should provide a reasonable to_s" do
     trans = Thrift::MemoryBufferTransport.new
-    Thrift::CompactProtocol.new(trans).to_s.should == "compact(memory)"
+    expect(Thrift::CompactProtocol.new(trans).to_s).to eq("compact(memory)")
   end
   
   class JankyHandler
@@ -149,10 +149,10 @@ end
 
 describe Thrift::CompactProtocolFactory do
   it "should create a CompactProtocol" do
-    Thrift::CompactProtocolFactory.new.get_protocol(mock("MockTransport")).should be_instance_of(Thrift::CompactProtocol)
+    expect(Thrift::CompactProtocolFactory.new.get_protocol(double("MockTransport"))).to be_instance_of(Thrift::CompactProtocol)
   end
 
   it "should provide a reasonable to_s" do
-    Thrift::CompactProtocolFactory.new.to_s.should == "compact"
+    expect(Thrift::CompactProtocolFactory.new.to_s).to eq("compact")
   end
 end

http://git-wip-us.apache.org/repos/asf/thrift/blob/27247079/lib/rb/spec/exception_spec.rb
----------------------------------------------------------------------
diff --git a/lib/rb/spec/exception_spec.rb b/lib/rb/spec/exception_spec.rb
index d1da621..379ae69 100644
--- a/lib/rb/spec/exception_spec.rb
+++ b/lib/rb/spec/exception_spec.rb
@@ -24,107 +24,107 @@ describe 'Exception' do
   describe Thrift::Exception do
     it "should have an accessible message" do
       e = Thrift::Exception.new("test message")
-      e.message.should == "test message"
+      expect(e.message).to eq("test message")
     end
   end
 
   describe Thrift::ApplicationException do
     it "should inherit from Thrift::Exception" do
-      Thrift::ApplicationException.superclass.should == Thrift::Exception
+      expect(Thrift::ApplicationException.superclass).to eq(Thrift::Exception)
     end
 
     it "should have an accessible type and message" do
       e = Thrift::ApplicationException.new
-      e.type.should == Thrift::ApplicationException::UNKNOWN
-      e.message.should be_nil
+      expect(e.type).to eq(Thrift::ApplicationException::UNKNOWN)
+      expect(e.message).to be_nil
       e = Thrift::ApplicationException.new(Thrift::ApplicationException::UNKNOWN_METHOD, "test message")
-      e.type.should == Thrift::ApplicationException::UNKNOWN_METHOD
-      e.message.should == "test message"
+      expect(e.type).to eq(Thrift::ApplicationException::UNKNOWN_METHOD)
+      expect(e.message).to eq("test message")
     end
 
     it "should read a struct off of a protocol" do
-      prot = mock("MockProtocol")
-      prot.should_receive(:read_struct_begin).ordered
-      prot.should_receive(:read_field_begin).exactly(3).times.and_return(
+      prot = double("MockProtocol")
+      expect(prot).to receive(:read_struct_begin).ordered
+      expect(prot).to receive(:read_field_begin).exactly(3).times.and_return(
         ["message", Thrift::Types::STRING, 1],
         ["type", Thrift::Types::I32, 2],
         [nil, Thrift::Types::STOP, 0]
       )
-      prot.should_receive(:read_string).ordered.and_return "test message"
-      prot.should_receive(:read_i32).ordered.and_return Thrift::ApplicationException::BAD_SEQUENCE_ID
-      prot.should_receive(:read_field_end).exactly(2).times
-      prot.should_receive(:read_struct_end).ordered
+      expect(prot).to receive(:read_string).ordered.and_return "test message"
+      expect(prot).to receive(:read_i32).ordered.and_return Thrift::ApplicationException::BAD_SEQUENCE_ID
+      expect(prot).to receive(:read_field_end).exactly(2).times
+      expect(prot).to receive(:read_struct_end).ordered
 
       e = Thrift::ApplicationException.new
       e.read(prot)
-      e.message.should == "test message"
-      e.type.should == Thrift::ApplicationException::BAD_SEQUENCE_ID
+      expect(e.message).to eq("test message")
+      expect(e.type).to eq(Thrift::ApplicationException::BAD_SEQUENCE_ID)
     end
 
     it "should skip bad fields when reading a struct" do
-      prot = mock("MockProtocol")
-      prot.should_receive(:read_struct_begin).ordered
-      prot.should_receive(:read_field_begin).exactly(5).times.and_return(
+      prot = double("MockProtocol")
+      expect(prot).to receive(:read_struct_begin).ordered
+      expect(prot).to receive(:read_field_begin).exactly(5).times.and_return(
         ["type", Thrift::Types::I32, 2],
         ["type", Thrift::Types::STRING, 2],
         ["message", Thrift::Types::MAP, 1],
         ["message", Thrift::Types::STRING, 3],
         [nil, Thrift::Types::STOP, 0]
       )
-      prot.should_receive(:read_i32).and_return Thrift::ApplicationException::INVALID_MESSAGE_TYPE
-      prot.should_receive(:skip).with(Thrift::Types::STRING).twice
-      prot.should_receive(:skip).with(Thrift::Types::MAP)
-      prot.should_receive(:read_field_end).exactly(4).times
-      prot.should_receive(:read_struct_end).ordered
+      expect(prot).to receive(:read_i32).and_return Thrift::ApplicationException::INVALID_MESSAGE_TYPE
+      expect(prot).to receive(:skip).with(Thrift::Types::STRING).twice
+      expect(prot).to receive(:skip).with(Thrift::Types::MAP)
+      expect(prot).to receive(:read_field_end).exactly(4).times
+      expect(prot).to receive(:read_struct_end).ordered
 
       e = Thrift::ApplicationException.new
       e.read(prot)
-      e.message.should be_nil
-      e.type.should == Thrift::ApplicationException::INVALID_MESSAGE_TYPE
+      expect(e.message).to be_nil
+      expect(e.type).to eq(Thrift::ApplicationException::INVALID_MESSAGE_TYPE)
     end
 
     it "should write a Thrift::ApplicationException struct to the oprot" do
-      prot = mock("MockProtocol")
-      prot.should_receive(:write_struct_begin).with("Thrift::ApplicationException").ordered
-      prot.should_receive(:write_field_begin).with("message", Thrift::Types::STRING, 1).ordered
-      prot.should_receive(:write_string).with("test message").ordered
-      prot.should_receive(:write_field_begin).with("type", Thrift::Types::I32, 2).ordered
-      prot.should_receive(:write_i32).with(Thrift::ApplicationException::UNKNOWN_METHOD).ordered
-      prot.should_receive(:write_field_end).twice
-      prot.should_receive(:write_field_stop).ordered
-      prot.should_receive(:write_struct_end).ordered
+      prot = double("MockProtocol")
+      expect(prot).to receive(:write_struct_begin).with("Thrift::ApplicationException").ordered
+      expect(prot).to receive(:write_field_begin).with("message", Thrift::Types::STRING, 1).ordered
+      expect(prot).to receive(:write_string).with("test message").ordered
+      expect(prot).to receive(:write_field_begin).with("type", Thrift::Types::I32, 2).ordered
+      expect(prot).to receive(:write_i32).with(Thrift::ApplicationException::UNKNOWN_METHOD).ordered
+      expect(prot).to receive(:write_field_end).twice
+      expect(prot).to receive(:write_field_stop).ordered
+      expect(prot).to receive(:write_struct_end).ordered
 
       e = Thrift::ApplicationException.new(Thrift::ApplicationException::UNKNOWN_METHOD, "test message")
       e.write(prot)
     end
 
     it "should skip nil fields when writing to the oprot" do
-      prot = mock("MockProtocol")
-      prot.should_receive(:write_struct_begin).with("Thrift::ApplicationException").ordered
-      prot.should_receive(:write_field_begin).with("message", Thrift::Types::STRING, 1).ordered
-      prot.should_receive(:write_string).with("test message").ordered
-      prot.should_receive(:write_field_end).ordered
-      prot.should_receive(:write_field_stop).ordered
-      prot.should_receive(:write_struct_end).ordered
+      prot = double("MockProtocol")
+      expect(prot).to receive(:write_struct_begin).with("Thrift::ApplicationException").ordered
+      expect(prot).to receive(:write_field_begin).with("message", Thrift::Types::STRING, 1).ordered
+      expect(prot).to receive(:write_string).with("test message").ordered
+      expect(prot).to receive(:write_field_end).ordered
+      expect(prot).to receive(:write_field_stop).ordered
+      expect(prot).to receive(:write_struct_end).ordered
 
       e = Thrift::ApplicationException.new(nil, "test message")
       e.write(prot)
 
-      prot = mock("MockProtocol")
-      prot.should_receive(:write_struct_begin).with("Thrift::ApplicationException").ordered
-      prot.should_receive(:write_field_begin).with("type", Thrift::Types::I32, 2).ordered
-      prot.should_receive(:write_i32).with(Thrift::ApplicationException::BAD_SEQUENCE_ID).ordered
-      prot.should_receive(:write_field_end).ordered
-      prot.should_receive(:write_field_stop).ordered
-      prot.should_receive(:write_struct_end).ordered
+      prot = double("MockProtocol")
+      expect(prot).to receive(:write_struct_begin).with("Thrift::ApplicationException").ordered
+      expect(prot).to receive(:write_field_begin).with("type", Thrift::Types::I32, 2).ordered
+      expect(prot).to receive(:write_i32).with(Thrift::ApplicationException::BAD_SEQUENCE_ID).ordered
+      expect(prot).to receive(:write_field_end).ordered
+      expect(prot).to receive(:write_field_stop).ordered
+      expect(prot).to receive(:write_struct_end).ordered
 
       e = Thrift::ApplicationException.new(Thrift::ApplicationException::BAD_SEQUENCE_ID)
       e.write(prot)
 
-      prot = mock("MockProtocol")
-      prot.should_receive(:write_struct_begin).with("Thrift::ApplicationException").ordered
-      prot.should_receive(:write_field_stop).ordered
-      prot.should_receive(:write_struct_end).ordered
+      prot = double("MockProtocol")
+      expect(prot).to receive(:write_struct_begin).with("Thrift::ApplicationException").ordered
+      expect(prot).to receive(:write_field_stop).ordered
+      expect(prot).to receive(:write_struct_end).ordered
 
       e = Thrift::ApplicationException.new(nil)
       e.write(prot)
@@ -134,8 +134,8 @@ describe 'Exception' do
   describe Thrift::ProtocolException do
     it "should have an accessible type" do
       prot = Thrift::ProtocolException.new(Thrift::ProtocolException::SIZE_LIMIT, "message")
-      prot.type.should == Thrift::ProtocolException::SIZE_LIMIT
-      prot.message.should == "message"
+      expect(prot.type).to eq(Thrift::ProtocolException::SIZE_LIMIT)
+      expect(prot.message).to eq("message")
     end
   end
 end

http://git-wip-us.apache.org/repos/asf/thrift/blob/27247079/lib/rb/spec/flat_spec.rb
----------------------------------------------------------------------
diff --git a/lib/rb/spec/flat_spec.rb b/lib/rb/spec/flat_spec.rb
index f378782..893056c 100644
--- a/lib/rb/spec/flat_spec.rb
+++ b/lib/rb/spec/flat_spec.rb
@@ -32,7 +32,7 @@ describe 'generation' do
      "other_namespace/referenced_constants.rb",
      "other_namespace/referenced_types.rb"
     ].each do |name|
-      File.exist?(File.join(prefix, name)).should_not be_true
+      expect(File.exist?(File.join(prefix, name))).not_to be_truthy
     end
   end
 
@@ -44,19 +44,19 @@ describe 'generation' do
      "referenced_constants.rb",
      "referenced_types.rb"
     ].each do |name|
-      File.exist?(File.join(prefix, name)).should be_true
+      expect(File.exist?(File.join(prefix, name))).to be_truthy
     end
   end
 
   it "has a service class in the right place" do
-    defined?(NamespacedSpecNamespace::NamespacedNonblockingService).should be_true
+    expect(defined?(NamespacedSpecNamespace::NamespacedNonblockingService)).to be_truthy
   end
 
   it "has a struct in the right place" do
-    defined?(NamespacedSpecNamespace::Hello).should be_true
+    expect(defined?(NamespacedSpecNamespace::Hello)).to be_truthy
   end
 
   it "required an included file" do
-    defined?(OtherNamespace::SomeEnum).should be_true
+    expect(defined?(OtherNamespace::SomeEnum)).to be_truthy
   end
 end