[DRE-commits] [ruby-mysql2] 05/06: port test suite to rspec 3 with `transpec`

Antonio Terceiro terceiro at moszumanska.debian.org
Tue Jul 21 01:28:22 UTC 2015


This is an automated email from the git hooks/post-receive script.

terceiro pushed a commit to branch master
in repository ruby-mysql2.

commit c260437c2b59379140914096ac67b01a3d891007
Author: Antonio Terceiro <terceiro at debian.org>
Date:   Mon Jul 20 22:25:35 2015 -0300

    port test suite to rspec 3 with `transpec`
---
 debian/changelog                    |    4 +
 debian/patches/port_to_rspec3.patch | 1605 +++++++++++++++++++++++++++++++++++
 debian/patches/series               |    1 +
 3 files changed, 1610 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index b07c6b9..206b318 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,10 @@ ruby-mysql2 (0.3.18-1) UNRELEASED; urgency=medium
   * debian/start_mysqld_and_auto_install.sh: skip database creation, since
     mysql seems to already create a database called `test` by default.
     Closes: #791785, #782768
+  * add port_to_rspec3.patch, created with `transpec` plus a few manual tweaks
+    to port test suite to RSpec3. This was already done upstream, but there
+    was no release since then. This patch must probably be dropped when the
+    next release comes.
 
  -- Antonio Terceiro <terceiro at debian.org>  Mon, 20 Jul 2015 21:31:34 -0300
 
diff --git a/debian/patches/port_to_rspec3.patch b/debian/patches/port_to_rspec3.patch
new file mode 100644
index 0000000..7260938
--- /dev/null
+++ b/debian/patches/port_to_rspec3.patch
@@ -0,0 +1,1605 @@
+--- a/spec/em/em_spec.rb
++++ b/spec/em/em_spec.rb
+@@ -24,8 +24,8 @@ begin
+         end
+       end
+ 
+-      results[0].keys.should include("second_query")
+-      results[1].keys.should include("first_query")
++      expect(results[0].keys).to include("second_query")
++      expect(results[1].keys).to include("first_query")
+     end
+ 
+     it "should support queries in callbacks" do
+@@ -44,12 +44,12 @@ begin
+         end
+       end
+ 
+-      results[0].keys.should include("first_query")
+-      results[1].keys.should include("second_query")
++      expect(results[0].keys).to include("first_query")
++      expect(results[1].keys).to include("second_query")
+     end
+ 
+     it "should not swallow exceptions raised in callbacks" do
+-      lambda {
++      expect {
+         EM.run do
+           client = Mysql2::EM::Client.new DatabaseCredentials['root']
+           defer = client.query "SELECT sleep(0.1) as first_query"
+@@ -63,13 +63,13 @@ begin
+             EM.stop_event_loop
+           end
+         end
+-      }.should raise_error
++      }.to raise_error
+     end
+ 
+     context 'when an exception is raised by the client' do
+       let(:client) { Mysql2::EM::Client.new DatabaseCredentials['root'] }
+       let(:error) { StandardError.new('some error') }
+-      before { client.stub(:async_result).and_raise(error) }
++      before { allow(client).to receive(:async_result).and_raise(error) }
+ 
+       it "should swallow exceptions raised in by the client" do
+         errors = []
+@@ -85,7 +85,7 @@ begin
+             EM.stop_event_loop
+           end
+         end
+-        errors.should == [error]
++        expect(errors).to eq([error])
+       end
+ 
+       it "should fail the deferrable" do
+@@ -105,7 +105,7 @@ begin
+             end
+           end
+         end
+-        callbacks_run.should == [:errback]
++        expect(callbacks_run).to eq([:errback])
+       end
+     end
+ 
+@@ -121,10 +121,10 @@ begin
+           callbacks_run << :errback
+         end
+         EM.add_timer(0.1) do
+-          callbacks_run.should == [:callback]
+-          lambda {
++          expect(callbacks_run).to eq([:callback])
++          expect {
+             client.close
+-          }.should_not raise_error(/invalid binding to detach/)
++          }.not_to raise_error
+           EM.stop_event_loop
+         end
+       end
+--- a/spec/mysql2/client_spec.rb
++++ b/spec/mysql2/client_spec.rb
+@@ -6,42 +6,42 @@ describe Mysql2::Client do
+     let(:cnf_file) { File.expand_path('../../my.cnf', __FILE__) }
+ 
+     it "should not raise an exception for valid defaults group" do
+-      lambda {
++      expect {
+         opts = DatabaseCredentials['root'].merge(:default_file => cnf_file, :default_group => "test")
+         @client = Mysql2::Client.new(opts)
+-      }.should_not raise_error(Mysql2::Error)
++      }.not_to raise_error
+     end
+ 
+     it "should not raise an exception without default group" do
+-      lambda {
++      expect {
+         @client = Mysql2::Client.new(DatabaseCredentials['root'].merge(:default_file => cnf_file))
+-      }.should_not raise_error(Mysql2::Error)
++      }.not_to raise_error
+     end
+   end
+ 
+   it "should raise an exception upon connection failure" do
+-    lambda {
++    expect {
+       # The odd local host IP address forces the mysql client library to
+       # use a TCP socket rather than a domain socket.
+       Mysql2::Client.new DatabaseCredentials['root'].merge('host' => '127.0.0.2', 'port' => 999999)
+-    }.should raise_error(Mysql2::Error)
++    }.to raise_error(Mysql2::Error)
+   end
+ 
+   if defined? Encoding
+     it "should raise an exception on create for invalid encodings" do
+-      lambda {
++      expect {
+         Mysql2::Client.new(DatabaseCredentials['root'].merge(:encoding => "fake"))
+-      }.should raise_error(Mysql2::Error)
++      }.to raise_error(Mysql2::Error)
+     end
+ 
+     it "should not raise an exception on create for a valid encoding" do
+-      lambda {
++      expect {
+         Mysql2::Client.new(DatabaseCredentials['root'].merge(:encoding => "utf8"))
+-      }.should_not raise_error(Mysql2::Error)
++      }.not_to raise_error
+ 
+-      lambda {
++      expect {
+         Mysql2::Client.new(DatabaseCredentials['root'].merge(:encoding => "big5"))
+-      }.should_not raise_error(Mysql2::Error)
++      }.not_to raise_error
+     end
+   end
+ 
+@@ -54,7 +54,7 @@ describe Mysql2::Client do
+       end
+     end
+     client = klient.new :flags => Mysql2::Client::FOUND_ROWS
+-    (client.connect_args.last[6] & Mysql2::Client::FOUND_ROWS).should be_true
++    expect(client.connect_args.last[6] & Mysql2::Client::FOUND_ROWS).to be_truthy
+   end
+ 
+   it "should default flags to (REMEMBER_OPTIONS, LONG_PASSWORD, LONG_FLAG, TRANSACTIONS, PROTOCOL_41, SECURE_CONNECTION)" do
+@@ -66,12 +66,12 @@ describe Mysql2::Client do
+       end
+     end
+     client = klient.new
+-    (client.connect_args.last[6] & (Mysql2::Client::REMEMBER_OPTIONS |
++    expect(client.connect_args.last[6] & (Mysql2::Client::REMEMBER_OPTIONS |
+                                      Mysql2::Client::LONG_PASSWORD |
+                                      Mysql2::Client::LONG_FLAG |
+                                      Mysql2::Client::TRANSACTIONS |
+                                      Mysql2::Client::PROTOCOL_41 |
+-                                     Mysql2::Client::SECURE_CONNECTION)).should be_true
++                                     Mysql2::Client::SECURE_CONNECTION)).to be_truthy
+   end
+ 
+   it "should execute init command" do
+@@ -79,7 +79,7 @@ describe Mysql2::Client do
+     options[:init_command] = "SET @something = 'setting_value';"
+     client = Mysql2::Client.new(options)
+     result = client.query("SELECT @something;")
+-    result.first['@something'].should eq('setting_value')
++    expect(result.first['@something']).to eq('setting_value')
+   end
+ 
+   it "should send init_command after reconnect" do
+@@ -89,7 +89,7 @@ describe Mysql2::Client do
+     client = Mysql2::Client.new(options)
+ 
+     result = client.query("SELECT @something;")
+-    result.first['@something'].should eq('setting_value')
++    expect(result.first['@something']).to eq('setting_value')
+ 
+     # get the current connection id
+     result = client.query("SELECT CONNECTION_ID()")
+@@ -108,15 +108,15 @@ describe Mysql2::Client do
+     second_conn_id = result.first['CONNECTION_ID()']
+ 
+     # confirm reconnect by checking the new connection id
+-    first_conn_id.should_not == second_conn_id
++    expect(first_conn_id).not_to eq(second_conn_id)
+ 
+     # At last, check that the init command executed
+     result = client.query("SELECT @something;")
+-    result.first['@something'].should eq('setting_value')
++    expect(result.first['@something']).to eq('setting_value')
+   end
+ 
+   it "should have a global default_query_options hash" do
+-    Mysql2::Client.should respond_to(:default_query_options)
++    expect(Mysql2::Client).to respond_to(:default_query_options)
+   end
+ 
+   it "should be able to connect via SSL options" do
+@@ -128,7 +128,7 @@ describe Mysql2::Client do
+ 
+     # You may need to adjust the lines below to match your SSL certificate paths
+     ssl_client = nil
+-    lambda {
++    expect {
+       ssl_client = Mysql2::Client.new(
+         :sslkey    => '/etc/mysql/client-key.pem',
+         :sslcert   => '/etc/mysql/client-cert.pem',
+@@ -136,18 +136,18 @@ describe Mysql2::Client do
+         :sslcapath => '/etc/mysql/',
+         :sslcipher => 'DHE-RSA-AES256-SHA'
+       )
+-    }.should_not raise_error(Mysql2::Error)
++    }.not_to raise_error
+ 
+     results = ssl_client.query("SHOW STATUS WHERE Variable_name = \"Ssl_version\" OR Variable_name = \"Ssl_cipher\"").to_a
+-    results[0]['Variable_name'].should eql('Ssl_cipher')
+-    results[0]['Value'].should_not be_nil
+-    results[0]['Value'].should be_kind_of(String)
+-    results[0]['Value'].should_not be_empty
+-
+-    results[1]['Variable_name'].should eql('Ssl_version')
+-    results[1]['Value'].should_not be_nil
+-    results[1]['Value'].should be_kind_of(String)
+-    results[1]['Value'].should_not be_empty
++    expect(results[0]['Variable_name']).to eql('Ssl_cipher')
++    expect(results[0]['Value']).not_to be_nil
++    expect(results[0]['Value']).to be_kind_of(String)
++    expect(results[0]['Value']).not_to be_empty
++
++    expect(results[1]['Variable_name']).to eql('Ssl_version')
++    expect(results[1]['Value']).not_to be_nil
++    expect(results[1]['Value']).to be_kind_of(String)
++    expect(results[1]['Value']).not_to be_empty
+ 
+     ssl_client.close
+   end
+@@ -162,12 +162,12 @@ describe Mysql2::Client do
+       Mysql2::Client.new(DatabaseCredentials['root']).query('SELECT 1')
+     end
+     after_count = client.query("SHOW STATUS LIKE 'Threads_connected'").first['Value'].to_i
+-    after_count.should == before_count + 10
++    expect(after_count).to eq(before_count + 10)
+ 
+     GC.start
+     sleep 0.300 # Let GC do its work
+     final_count = client.query("SHOW STATUS LIKE 'Threads_connected'").first['Value'].to_i
+-    final_count.should == before_count
++    expect(final_count).to eq(before_count)
+   end
+ 
+   if Process.respond_to?(:fork)
+@@ -192,39 +192,39 @@ describe Mysql2::Client do
+   end
+ 
+   it "should be able to connect to database with numeric-only name" do
+-    lambda {
++    expect {
+       creds = DatabaseCredentials['numericuser']
+       @client.query "CREATE DATABASE IF NOT EXISTS `#{creds['database']}`"
+       @client.query "GRANT ALL ON `#{creds['database']}`.* TO #{creds['username']}@`#{creds['host']}`"
+       client = Mysql2::Client.new creds
+       @client.query "DROP DATABASE IF EXISTS `#{creds['database']}`"
+-    }.should_not raise_error
++    }.not_to raise_error
+   end
+ 
+   it "should respond to #close" do
+-    @client.should respond_to(:close)
++    expect(@client).to respond_to(:close)
+   end
+ 
+   it "should be able to close properly" do
+-    @client.close.should be_nil
+-    lambda {
++    expect(@client.close).to be_nil
++    expect {
+       @client.query "SELECT 1"
+-    }.should raise_error(Mysql2::Error)
++    }.to raise_error(Mysql2::Error)
+   end
+ 
+   it "should respond to #query" do
+-    @client.should respond_to(:query)
++    expect(@client).to respond_to(:query)
+   end
+ 
+   it "should respond to #warning_count" do
+-    @client.should respond_to(:warning_count)
++    expect(@client).to respond_to(:warning_count)
+   end
+ 
+   context "#warning_count" do
+     context "when no warnings" do
+       it "should 0" do
+         @client.query('select 1')
+-        @client.warning_count.should == 0
++        expect(@client.warning_count).to eq(0)
+       end
+     end
+     context "when has a warnings" do
+@@ -232,21 +232,21 @@ describe Mysql2::Client do
+         # "the statement produces extra information that can be viewed by issuing a SHOW WARNINGS"
+         # http://dev.mysql.com/doc/refman/5.0/en/explain-extended.html
+         @client.query("explain extended select 1")
+-        @client.warning_count.should > 0
++        expect(@client.warning_count).to be > 0
+       end
+     end
+   end
+ 
+   it "should respond to #query_info" do
+-    @client.should respond_to(:query_info)
++    expect(@client).to respond_to(:query_info)
+   end
+ 
+   context "#query_info" do
+     context "when no info present" do
+       it "should 0" do
+         @client.query('select 1')
+-        @client.query_info.should be_empty
+-        @client.query_info_string.should be_nil
++        expect(@client.query_info).to be_empty
++        expect(@client.query_info_string).to be_nil
+       end
+     end
+     context "when has some info" do
+@@ -258,8 +258,8 @@ describe Mysql2::Client do
+         # # Note that mysql_info() returns a non-NULL value for INSERT ... VALUES only for the multiple-row form of the statement (that is, only if multiple value lists are specified).
+         @client.query("INSERT INTO infoTest (blah) VALUES (1234),(4535)")
+ 
+-        @client.query_info.should  eql({:records => 2, :duplicates => 0, :warnings => 0})
+-        @client.query_info_string.should eq('Records: 2  Duplicates: 0  Warnings: 0')
++        expect(@client.query_info).to  eql({:records => 2, :duplicates => 0, :warnings => 0})
++        expect(@client.query_info_string).to eq('Records: 2  Duplicates: 0  Warnings: 0')
+ 
+         @client.query "DROP TABLE infoTest"
+       end
+@@ -288,43 +288,43 @@ describe Mysql2::Client do
+ 
+     it "should raise an error when local_infile is disabled" do
+       client = Mysql2::Client.new DatabaseCredentials['root'].merge(:local_infile => false)
+-      lambda {
++      expect {
+         client.query "LOAD DATA LOCAL INFILE 'spec/test_data' INTO TABLE infileTest"
+-      }.should raise_error(Mysql2::Error, %r{command is not allowed})
++      }.to raise_error(Mysql2::Error, %r{command is not allowed})
+     end
+ 
+     it "should raise an error when a non-existent file is loaded" do
+-      lambda {
++      expect {
+         @client_i.query "LOAD DATA LOCAL INFILE 'this/file/is/not/here' INTO TABLE infileTest"
+-      }.should_not raise_error(Mysql2::Error, %r{file not found: this/file/is/not/here})
++      }.to raise_error(Mysql2::Error)
+     end
+ 
+     it "should LOAD DATA LOCAL INFILE" do
+       @client_i.query "LOAD DATA LOCAL INFILE 'spec/test_data' INTO TABLE infileTest"
+       info = @client_i.query_info
+-      info.should eql({:records => 1, :deleted => 0, :skipped => 0, :warnings => 0})
++      expect(info).to eql({:records => 1, :deleted => 0, :skipped => 0, :warnings => 0})
+ 
+       result = @client_i.query "SELECT * FROM infileTest"
+-      result.first.should eql({'id' => 1, 'foo' => 'Hello', 'bar' => 'World'})
++      expect(result.first).to eql({'id' => 1, 'foo' => 'Hello', 'bar' => 'World'})
+     end
+   end
+ 
+   it "should expect connect_timeout to be a positive integer" do
+-    lambda {
++    expect {
+       Mysql2::Client.new(:connect_timeout => -1)
+-    }.should raise_error(Mysql2::Error)
++    }.to raise_error(Mysql2::Error)
+   end
+ 
+   it "should expect read_timeout to be a positive integer" do
+-    lambda {
++    expect {
+       Mysql2::Client.new(:read_timeout => -1)
+-    }.should raise_error(Mysql2::Error)
++    }.to raise_error(Mysql2::Error)
+   end
+ 
+   it "should expect write_timeout to be a positive integer" do
+-    lambda {
++    expect {
+       Mysql2::Client.new(:write_timeout => -1)
+-    }.should raise_error(Mysql2::Error)
++    }.to raise_error(Mysql2::Error)
+   end
+ 
+   context "#query" do
+@@ -333,7 +333,7 @@ describe Mysql2::Client do
+ 
+       expect {
+         @client.query("SELECT 1 UNION SELECT 2", :stream => true, :cache_rows => false)
+-      }.to_not raise_exception(Mysql2::Error)
++      }.to_not raise_error
+     end
+ 
+     it "should not let you query again if iterating is not finished when streaming" do
+@@ -345,59 +345,59 @@ describe Mysql2::Client do
+     end
+ 
+     it "should only accept strings as the query parameter" do
+-      lambda {
++      expect {
+         @client.query ["SELECT 'not right'"]
+-      }.should raise_error(TypeError)
++      }.to raise_error(TypeError)
+     end
+ 
+     it "should not retain query options set on a query for subsequent queries, but should retain it in the result" do
+       result = @client.query "SELECT 1", :something => :else
+-      @client.query_options[:something].should be_nil
+-      result.instance_variable_get('@query_options').should eql(@client.query_options.merge(:something => :else))
+-      @client.instance_variable_get('@current_query_options').should eql(@client.query_options.merge(:something => :else))
++      expect(@client.query_options[:something]).to be_nil
++      expect(result.instance_variable_get('@query_options')).to eql(@client.query_options.merge(:something => :else))
++      expect(@client.instance_variable_get('@current_query_options')).to eql(@client.query_options.merge(:something => :else))
+ 
+       result = @client.query "SELECT 1"
+-      result.instance_variable_get('@query_options').should eql(@client.query_options)
+-      @client.instance_variable_get('@current_query_options').should eql(@client.query_options)
++      expect(result.instance_variable_get('@query_options')).to eql(@client.query_options)
++      expect(@client.instance_variable_get('@current_query_options')).to eql(@client.query_options)
+     end
+ 
+     it "should allow changing query options for subsequent queries" do
+       @client.query_options.merge!(:something => :else)
+       result = @client.query "SELECT 1"
+-      @client.query_options[:something].should eql(:else)
+-      result.instance_variable_get('@query_options')[:something].should eql(:else)
++      expect(@client.query_options[:something]).to eql(:else)
++      expect(result.instance_variable_get('@query_options')[:something]).to eql(:else)
+ 
+       # Clean up after this test
+       @client.query_options.delete(:something)
+-      @client.query_options[:something].should be_nil
++      expect(@client.query_options[:something]).to be_nil
+     end
+ 
+     it "should return results as a hash by default" do
+-      @client.query("SELECT 1").first.class.should eql(Hash)
++      expect(@client.query("SELECT 1").first.class).to eql(Hash)
+     end
+ 
+     it "should be able to return results as an array" do
+-      @client.query("SELECT 1", :as => :array).first.class.should eql(Array)
++      expect(@client.query("SELECT 1", :as => :array).first.class).to eql(Array)
+       @client.query("SELECT 1").each(:as => :array)
+     end
+ 
+     it "should be able to return results with symbolized keys" do
+-      @client.query("SELECT 1", :symbolize_keys => true).first.keys[0].class.should eql(Symbol)
++      expect(@client.query("SELECT 1", :symbolize_keys => true).first.keys[0].class).to eql(Symbol)
+     end
+ 
+     it "should require an open connection" do
+       @client.close
+-      lambda {
++      expect {
+         @client.query "SELECT 1"
+-      }.should raise_error(Mysql2::Error)
++      }.to raise_error(Mysql2::Error)
+     end
+ 
+     if RUBY_PLATFORM !~ /mingw|mswin/
+       it "should not allow another query to be sent without fetching a result first" do
+         @client.query("SELECT 1", :async => true)
+-        lambda {
++        expect {
+           @client.query("SELECT 1")
+-        }.should raise_error(Mysql2::Error)
++        }.to raise_error(Mysql2::Error)
+       end
+ 
+       it "should describe the thread holding the active query" do
+@@ -410,14 +410,14 @@ describe Mysql2::Client do
+           message = e.message
+         end
+         re = Regexp.escape(thr.inspect)
+-        message.should match(Regexp.new(re))
++        expect(message).to match(Regexp.new(re))
+       end
+ 
+       it "should timeout if we wait longer than :read_timeout" do
+         client = Mysql2::Client.new(DatabaseCredentials['root'].merge(:read_timeout => 1))
+-        lambda {
++        expect {
+           client.query("SELECT sleep(2)")
+-        }.should raise_error(Mysql2::Error)
++        }.to raise_error(Mysql2::Error)
+       end
+ 
+       if !defined? Rubinius
+@@ -436,12 +436,12 @@ describe Mysql2::Client do
+             end
+             @client.query("SELECT sleep(2)")
+             mark[:END] = Time.now
+-            mark.include?(:USR1).should be_true
+-            (mark[:USR1] - mark[:START]).should >= 1
+-            (mark[:USR1] - mark[:START]).should < 1.3
+-            (mark[:END] - mark[:USR1]).should > 0.9
+-            (mark[:END] - mark[:START]).should >= 2
+-            (mark[:END] - mark[:START]).should < 2.3
++            expect(mark.include?(:USR1)).to be_truthy
++            expect(mark[:USR1] - mark[:START]).to be >= 1
++            expect(mark[:USR1] - mark[:START]).to be < 1.3
++            expect(mark[:END] - mark[:USR1]).to be > 0.9
++            expect(mark[:END] - mark[:START]).to be >= 2
++            expect(mark[:END] - mark[:START]).to be < 2.3
+           ensure
+             trap(:USR1, 'DEFAULT')
+             if !pid.nil?
+@@ -453,15 +453,15 @@ describe Mysql2::Client do
+       end
+ 
+       it "#socket should return a Fixnum (file descriptor from C)" do
+-        @client.socket.class.should eql(Fixnum)
+-        @client.socket.should_not eql(0)
++        expect(@client.socket.class).to eql(Fixnum)
++        expect(@client.socket).not_to eql(0)
+       end
+ 
+       it "#socket should require an open connection" do
+         @client.close
+-        lambda {
++        expect {
+           @client.socket
+-        }.should raise_error(Mysql2::Error)
++        }.to raise_error(Mysql2::Error)
+       end
+ 
+       it "should close the connection when an exception is raised" do
+@@ -472,9 +472,9 @@ describe Mysql2::Client do
+         rescue Timeout::Error
+         end
+ 
+-        lambda {
++        expect {
+           @client.query("SELECT 1")
+-        }.should raise_error(Mysql2::Error, 'closed MySQL connection')
++        }.to raise_error(Mysql2::Error, 'closed MySQL connection')
+       end
+ 
+       it "should handle Timeouts without leaving the connection hanging if reconnect is true" do
+@@ -486,9 +486,9 @@ describe Mysql2::Client do
+         rescue Timeout::Error
+         end
+ 
+-        lambda {
++        expect {
+           client.query("SELECT 1")
+-        }.should_not raise_error(Mysql2::Error)
++        }.not_to raise_error
+       end
+ 
+       it "should handle Timeouts without leaving the connection hanging if reconnect is set to true after construction true" do
+@@ -500,9 +500,9 @@ describe Mysql2::Client do
+         rescue Timeout::Error
+         end
+ 
+-        lambda {
++        expect {
+           client.query("SELECT 1")
+-        }.should raise_error(Mysql2::Error)
++        }.to raise_error(Mysql2::Error)
+ 
+         client.reconnect = true
+ 
+@@ -513,9 +513,9 @@ describe Mysql2::Client do
+         rescue Timeout::Error
+         end
+ 
+-        lambda {
++        expect {
+           client.query("SELECT 1")
+-        }.should_not raise_error(Mysql2::Error)
++        }.not_to raise_error
+ 
+       end
+ 
+@@ -536,12 +536,12 @@ describe Mysql2::Client do
+           }
+         end
+         threads.each{|t| t.join }
+-        results.keys.sort.should eql(threads.map{|t| t.object_id }.sort)
++        expect(results.keys.sort).to eql(threads.map{|t| t.object_id }.sort)
+       end
+ 
+       it "evented async queries should be supported" do
+         # should immediately return nil
+-        @client.query("SELECT sleep(0.1)", :async => true).should eql(nil)
++        expect(@client.query("SELECT sleep(0.1)", :async => true)).to eql(nil)
+ 
+         io_wrapper = IO.for_fd(@client.socket)
+         loops = 0
+@@ -554,10 +554,10 @@ describe Mysql2::Client do
+         end
+ 
+         # make sure we waited some period of time
+-        (loops >= 1).should be_true
++        expect(loops >= 1).to be_truthy
+ 
+         result = @client.async_result
+-        result.class.should eql(Mysql2::Result)
++        expect(result.class).to eql(Mysql2::Result)
+       end
+     end
+ 
+@@ -568,20 +568,20 @@ describe Mysql2::Client do
+ 
+       it "should raise an exception when one of multiple statements fails" do
+         result = @multi_client.query("SELECT 1 AS 'set_1'; SELECT * FROM invalid_table_name; SELECT 2 AS 'set_2';")
+-        result.first['set_1'].should be(1)
+-        lambda {
++        expect(result.first['set_1']).to be(1)
++        expect {
+           @multi_client.next_result
+-        }.should raise_error(Mysql2::Error)
+-        @multi_client.next_result.should be_false
++        }.to raise_error(Mysql2::Error)
++        expect(@multi_client.next_result).to be_falsey
+       end
+ 
+       it "returns multiple result sets" do
+-        @multi_client.query("SELECT 1 AS 'set_1'; SELECT 2 AS 'set_2'").first.should eql({ 'set_1' => 1 })
++        expect(@multi_client.query("SELECT 1 AS 'set_1'; SELECT 2 AS 'set_2'").first).to eql({ 'set_1' => 1 })
+ 
+-        @multi_client.next_result.should be_true
+-        @multi_client.store_result.first.should eql({ 'set_2' => 2 })
++        expect(@multi_client.next_result).to be_truthy
++        expect(@multi_client.store_result.first).to eql({ 'set_2' => 2 })
+ 
+-        @multi_client.next_result.should be_false
++        expect(@multi_client.next_result).to be_falsey
+       end
+ 
+       it "does not interfere with other statements" do
+@@ -590,208 +590,208 @@ describe Mysql2::Client do
+           @multi_client.store_result
+         end
+ 
+-        @multi_client.query("SELECT 3 AS 'next'").first.should == { 'next' => 3 }
++        expect(@multi_client.query("SELECT 3 AS 'next'").first).to eq({ 'next' => 3 })
+       end
+ 
+       it "will raise on query if there are outstanding results to read" do
+         @multi_client.query("SELECT 1; SELECT 2; SELECT 3")
+-        lambda {
++        expect {
+           @multi_client.query("SELECT 4")
+-        }.should raise_error(Mysql2::Error)
++        }.to raise_error(Mysql2::Error)
+       end
+ 
+       it "#abandon_results! should work" do
+         @multi_client.query("SELECT 1; SELECT 2; SELECT 3")
+         @multi_client.abandon_results!
+-        lambda {
++        expect {
+           @multi_client.query("SELECT 4")
+-        }.should_not raise_error(Mysql2::Error)
++        }.not_to raise_error
+       end
+ 
+       it "#more_results? should work" do
+         @multi_client.query("SELECT 1 AS 'set_1'; SELECT 2 AS 'set_2'")
+-        @multi_client.more_results?.should be_true
++        expect(@multi_client.more_results?).to be_truthy
+ 
+         @multi_client.next_result
+         @multi_client.store_result
+ 
+-        @multi_client.more_results?.should be_false
++        expect(@multi_client.more_results?).to be_falsey
+       end
+     end
+   end
+ 
+   it "should respond to #socket" do
+-    @client.should respond_to(:socket)
++    expect(@client).to respond_to(:socket)
+   end
+ 
+   if RUBY_PLATFORM =~ /mingw|mswin/
+     it "#socket should raise as it's not supported" do
+-      lambda {
++      expect {
+         @client.socket
+-      }.should raise_error(Mysql2::Error)
++      }.to raise_error(Mysql2::Error)
+     end
+   end
+ 
+   it "should respond to escape" do
+-    Mysql2::Client.should respond_to(:escape)
++    expect(Mysql2::Client).to respond_to(:escape)
+   end
+ 
+   context "escape" do
+     it "should return a new SQL-escape version of the passed string" do
+-      Mysql2::Client.escape("abc'def\"ghi\0jkl%mno").should eql("abc\\'def\\\"ghi\\0jkl%mno")
++      expect(Mysql2::Client.escape("abc'def\"ghi\0jkl%mno")).to eql("abc\\'def\\\"ghi\\0jkl%mno")
+     end
+ 
+     it "should return the passed string if nothing was escaped" do
+       str = "plain"
+-      Mysql2::Client.escape(str).object_id.should eql(str.object_id)
++      expect(Mysql2::Client.escape(str).object_id).to eql(str.object_id)
+     end
+ 
+     it "should not overflow the thread stack" do
+-      lambda {
++      expect {
+         Thread.new { Mysql2::Client.escape("'" * 256 * 1024) }.join
+-      }.should_not raise_error(SystemStackError)
++      }.not_to raise_error
+     end
+ 
+     it "should not overflow the process stack" do
+-      lambda {
++      expect {
+         Thread.new { Mysql2::Client.escape("'" * 1024 * 1024 * 4) }.join
+-      }.should_not raise_error(SystemStackError)
++      }.not_to raise_error
+     end
+ 
+     unless RUBY_VERSION =~ /1.8/
+       it "should carry over the original string's encoding" do
+         str = "abc'def\"ghi\0jkl%mno"
+         escaped = Mysql2::Client.escape(str)
+-        escaped.encoding.should eql(str.encoding)
++        expect(escaped.encoding).to eql(str.encoding)
+ 
+         str.encode!('us-ascii')
+         escaped = Mysql2::Client.escape(str)
+-        escaped.encoding.should eql(str.encoding)
++        expect(escaped.encoding).to eql(str.encoding)
+       end
+     end
+   end
+ 
+   it "should respond to #escape" do
+-    @client.should respond_to(:escape)
++    expect(@client).to respond_to(:escape)
+   end
+ 
+   context "#escape" do
+     it "should return a new SQL-escape version of the passed string" do
+-      @client.escape("abc'def\"ghi\0jkl%mno").should eql("abc\\'def\\\"ghi\\0jkl%mno")
++      expect(@client.escape("abc'def\"ghi\0jkl%mno")).to eql("abc\\'def\\\"ghi\\0jkl%mno")
+     end
+ 
+     it "should return the passed string if nothing was escaped" do
+       str = "plain"
+-      @client.escape(str).object_id.should eql(str.object_id)
++      expect(@client.escape(str).object_id).to eql(str.object_id)
+     end
+ 
+     it "should not overflow the thread stack" do
+-      lambda {
++      expect {
+         Thread.new { @client.escape("'" * 256 * 1024) }.join
+-      }.should_not raise_error(SystemStackError)
++      }.not_to raise_error
+     end
+ 
+     it "should not overflow the process stack" do
+-      lambda {
++      expect {
+         Thread.new { @client.escape("'" * 1024 * 1024 * 4) }.join
+-      }.should_not raise_error(SystemStackError)
++      }.not_to raise_error
+     end
+ 
+     it "should require an open connection" do
+       @client.close
+-      lambda {
++      expect {
+         @client.escape ""
+-      }.should raise_error(Mysql2::Error)
++      }.to raise_error(Mysql2::Error)
+     end
+   end
+ 
+   it "should respond to #info" do
+-    @client.should respond_to(:info)
++    expect(@client).to respond_to(:info)
+   end
+ 
+   it "#info should return a hash containing the client version ID and String" do
+     info = @client.info
+-    info.class.should eql(Hash)
+-    info.should have_key(:id)
+-    info[:id].class.should eql(Fixnum)
+-    info.should have_key(:version)
+-    info[:version].class.should eql(String)
++    expect(info.class).to eql(Hash)
++    expect(info).to have_key(:id)
++    expect(info[:id].class).to eql(Fixnum)
++    expect(info).to have_key(:version)
++    expect(info[:version].class).to eql(String)
+   end
+ 
+   if defined? Encoding
+     context "strings returned by #info" do
+       it "should default to the connection's encoding if Encoding.default_internal is nil" do
+         with_internal_encoding nil do
+-          @client.info[:version].encoding.should eql(Encoding.find('utf-8'))
++          expect(@client.info[:version].encoding).to eql(Encoding.find('utf-8'))
+ 
+           client2 = Mysql2::Client.new(DatabaseCredentials['root'].merge(:encoding => 'ascii'))
+-          client2.info[:version].encoding.should eql(Encoding.find('us-ascii'))
++          expect(client2.info[:version].encoding).to eql(Encoding.find('us-ascii'))
+         end
+       end
+ 
+       it "should use Encoding.default_internal" do
+         with_internal_encoding 'utf-8' do
+-          @client.info[:version].encoding.should eql(Encoding.default_internal)
++          expect(@client.info[:version].encoding).to eql(Encoding.default_internal)
+         end
+ 
+         with_internal_encoding 'us-ascii' do
+-          @client.info[:version].encoding.should eql(Encoding.default_internal)
++          expect(@client.info[:version].encoding).to eql(Encoding.default_internal)
+         end
+       end
+     end
+   end
+ 
+   it "should respond to #server_info" do
+-    @client.should respond_to(:server_info)
++    expect(@client).to respond_to(:server_info)
+   end
+ 
+   it "#server_info should return a hash containing the client version ID and String" do
+     server_info = @client.server_info
+-    server_info.class.should eql(Hash)
+-    server_info.should have_key(:id)
+-    server_info[:id].class.should eql(Fixnum)
+-    server_info.should have_key(:version)
+-    server_info[:version].class.should eql(String)
++    expect(server_info.class).to eql(Hash)
++    expect(server_info).to have_key(:id)
++    expect(server_info[:id].class).to eql(Fixnum)
++    expect(server_info).to have_key(:version)
++    expect(server_info[:version].class).to eql(String)
+   end
+ 
+   it "#server_info should require an open connection" do
+     @client.close
+-    lambda {
++    expect {
+       @client.server_info
+-    }.should raise_error(Mysql2::Error)
++    }.to raise_error(Mysql2::Error)
+   end
+ 
+   if defined? Encoding
+     context "strings returned by #server_info" do
+       it "should default to the connection's encoding if Encoding.default_internal is nil" do
+         with_internal_encoding nil do
+-          @client.server_info[:version].encoding.should eql(Encoding.find('utf-8'))
++          expect(@client.server_info[:version].encoding).to eql(Encoding.find('utf-8'))
+ 
+           client2 = Mysql2::Client.new(DatabaseCredentials['root'].merge(:encoding => 'ascii'))
+-          client2.server_info[:version].encoding.should eql(Encoding.find('us-ascii'))
++          expect(client2.server_info[:version].encoding).to eql(Encoding.find('us-ascii'))
+         end
+       end
+ 
+       it "should use Encoding.default_internal" do
+         with_internal_encoding 'utf-8' do
+-          @client.server_info[:version].encoding.should eql(Encoding.default_internal)
++          expect(@client.server_info[:version].encoding).to eql(Encoding.default_internal)
+         end
+ 
+         with_internal_encoding 'us-ascii' do
+-          @client.server_info[:version].encoding.should eql(Encoding.default_internal)
++          expect(@client.server_info[:version].encoding).to eql(Encoding.default_internal)
+         end
+       end
+     end
+   end
+ 
+   it "should raise a Mysql2::Error exception upon connection failure" do
+-    lambda {
++    expect {
+       Mysql2::Client.new :host => "localhost", :username => 'asdfasdf8d2h', :password => 'asdfasdfw42'
+-    }.should raise_error(Mysql2::Error)
++    }.to raise_error(Mysql2::Error)
+ 
+-    lambda {
++    expect {
+       Mysql2::Client.new DatabaseCredentials['root']
+-    }.should_not raise_error(Mysql2::Error)
++    }.not_to raise_error
+   end
+ 
+   context 'write operations api' do
+@@ -805,46 +805,46 @@ describe Mysql2::Client do
+     end
+ 
+     it "should respond to #last_id" do
+-      @client.should respond_to(:last_id)
++      expect(@client).to respond_to(:last_id)
+     end
+ 
+     it "#last_id should return a Fixnum, the from the last INSERT/UPDATE" do
+-      @client.last_id.should eql(0)
++      expect(@client.last_id).to eql(0)
+       @client.query "INSERT INTO lastIdTest (blah) VALUES (1234)"
+-      @client.last_id.should eql(1)
++      expect(@client.last_id).to eql(1)
+     end
+ 
+     it "should respond to #last_id" do
+-      @client.should respond_to(:last_id)
++      expect(@client).to respond_to(:last_id)
+     end
+ 
+     it "#last_id should return a Fixnum, the from the last INSERT/UPDATE" do
+       @client.query "INSERT INTO lastIdTest (blah) VALUES (1234)"
+-      @client.affected_rows.should eql(1)
++      expect(@client.affected_rows).to eql(1)
+       @client.query "UPDATE lastIdTest SET blah=4321 WHERE id=1"
+-      @client.affected_rows.should eql(1)
++      expect(@client.affected_rows).to eql(1)
+     end
+ 
+     it "#last_id should handle BIGINT auto-increment ids above 32 bits" do
+       # The id column type must be BIGINT. Surprise: INT(x) is limited to 32-bits for all values of x.
+       # Insert a row with a given ID, this should raise the auto-increment state
+       @client.query "INSERT INTO lastIdTest (id, blah) VALUES (5000000000, 5000)"
+-      @client.last_id.should eql(5000000000)
++      expect(@client.last_id).to eql(5000000000)
+       @client.query "INSERT INTO lastIdTest (blah) VALUES (5001)"
+-      @client.last_id.should eql(5000000001)
++      expect(@client.last_id).to eql(5000000001)
+     end
+   end
+ 
+   it "should respond to #thread_id" do
+-    @client.should respond_to(:thread_id)
++    expect(@client).to respond_to(:thread_id)
+   end
+ 
+   it "#thread_id should be a Fixnum" do
+-    @client.thread_id.class.should eql(Fixnum)
++    expect(@client.thread_id.class).to eql(Fixnum)
+   end
+ 
+   it "should respond to #ping" do
+-    @client.should respond_to(:ping)
++    expect(@client).to respond_to(:ping)
+   end
+ 
+   context "select_db" do
+@@ -863,38 +863,38 @@ describe Mysql2::Client do
+     end
+ 
+     it "should respond to #select_db" do
+-      @client.should respond_to(:select_db)
++      expect(@client).to respond_to(:select_db)
+     end
+ 
+     it "should switch databases" do
+       @client.select_db("test_selectdb_0")
+-      @client.query("SHOW TABLES").first.values.first.should eql("test0")
++      expect(@client.query("SHOW TABLES").first.values.first).to eql("test0")
+       @client.select_db("test_selectdb_1")
+-      @client.query("SHOW TABLES").first.values.first.should eql("test1")
++      expect(@client.query("SHOW TABLES").first.values.first).to eql("test1")
+       @client.select_db("test_selectdb_0")
+-      @client.query("SHOW TABLES").first.values.first.should eql("test0")
++      expect(@client.query("SHOW TABLES").first.values.first).to eql("test0")
+     end
+ 
+     it "should raise a Mysql2::Error when the database doesn't exist" do
+-      lambda {
++      expect {
+         @client.select_db("nopenothere")
+-      }.should raise_error(Mysql2::Error)
++      }.to raise_error(Mysql2::Error)
+     end
+ 
+     it "should return the database switched to" do
+-      @client.select_db("test_selectdb_1").should eq("test_selectdb_1")
++      expect(@client.select_db("test_selectdb_1")).to eq("test_selectdb_1")
+     end
+   end
+ 
+   it "#thread_id should return a boolean" do
+-    @client.ping.should eql(true)
++    expect(@client.ping).to eql(true)
+     @client.close
+-    @client.ping.should eql(false)
++    expect(@client.ping).to eql(false)
+   end
+ 
+   unless RUBY_VERSION =~ /1.8/
+     it "should respond to #encoding" do
+-      @client.should respond_to(:encoding)
++      expect(@client).to respond_to(:encoding)
+     end
+   end
+ end
+--- a/spec/mysql2/error_spec.rb
++++ b/spec/mysql2/error_spec.rb
+@@ -18,12 +18,12 @@ describe Mysql2::Error do
+   end
+ 
+   it "responds to error_number and sql_state, with aliases" do
+-    error.should respond_to(:error_number)
+-    error.should respond_to(:sql_state)
++    expect(error).to respond_to(:error_number)
++    expect(error).to respond_to(:sql_state)
+ 
+     # Mysql gem compatibility
+-    error.should respond_to(:errno)
+-    error.should respond_to(:error)
++    expect(error).to respond_to(:errno)
++    expect(error).to respond_to(:error)
+   end
+ 
+   if "".respond_to? :encoding
+@@ -55,27 +55,27 @@ describe Mysql2::Error do
+ 
+     it "returns error messages as UTF-8 by default" do
+       with_internal_encoding nil do
+-        error.message.encoding.should eql(Encoding::UTF_8)
++        expect(error.message.encoding).to eql(Encoding::UTF_8)
+         error.message.valid_encoding?
+ 
+-        bad_err.message.encoding.should eql(Encoding::UTF_8)
++        expect(bad_err.message.encoding).to eql(Encoding::UTF_8)
+         bad_err.message.valid_encoding?
+ 
+-        bad_err.message.should include("??}\u001F")
++        expect(bad_err.message).to include("??}\u001F")
+       end
+     end
+ 
+     it "returns sql state as ASCII" do
+-      error.sql_state.encoding.should eql(Encoding::US_ASCII)
++      expect(error.sql_state.encoding).to eql(Encoding::US_ASCII)
+       error.sql_state.valid_encoding?
+     end
+ 
+     it "returns error messages and sql state in Encoding.default_internal if set" do
+       with_internal_encoding 'UTF-16LE' do
+-        error.message.encoding.should eql(Encoding.default_internal)
++        expect(error.message.encoding).to eql(Encoding.default_internal)
+         error.message.valid_encoding?
+ 
+-        bad_err.message.encoding.should eql(Encoding.default_internal)
++        expect(bad_err.message.encoding).to eql(Encoding.default_internal)
+         bad_err.message.valid_encoding?
+       end
+     end
+--- a/spec/mysql2/result_spec.rb
++++ b/spec/mysql2/result_spec.rb
+@@ -7,33 +7,33 @@ describe Mysql2::Result do
+   end
+ 
+   it "should have included Enumerable" do
+-    Mysql2::Result.ancestors.include?(Enumerable).should be_true
++    expect(Mysql2::Result.ancestors.include?(Enumerable)).to be_truthy
+   end
+ 
+   it "should respond to #each" do
+-    @result.should respond_to(:each)
++    expect(@result).to respond_to(:each)
+   end
+ 
+   it "should raise a Mysql2::Error exception upon a bad query" do
+-    lambda {
++    expect {
+       @client.query "bad sql"
+-    }.should raise_error(Mysql2::Error)
++    }.to raise_error(Mysql2::Error)
+ 
+-    lambda {
++    expect {
+       @client.query "SELECT 1"
+-    }.should_not raise_error(Mysql2::Error)
++    }.not_to raise_error
+   end
+ 
+   it "should respond to #count, which is aliased as #size" do
+     r = @client.query "SELECT 1"
+-    r.should respond_to :count
+-    r.should respond_to :size
++    expect(r).to respond_to :count
++    expect(r).to respond_to :size
+   end
+ 
+   it "should be able to return the number of rows in the result set" do
+     r = @client.query "SELECT 1"
+-    r.count.should eql(1)
+-    r.size.should eql(1)
++    expect(r.count).to eql(1)
++    expect(r.size).to eql(1)
+   end
+ 
+   context "metadata queries" do
+@@ -45,39 +45,39 @@ describe Mysql2::Result do
+   context "#each" do
+     it "should yield rows as hash's" do
+       @result.each do |row|
+-        row.class.should eql(Hash)
++        expect(row.class).to eql(Hash)
+       end
+     end
+ 
+     it "should yield rows as hash's with symbol keys if :symbolize_keys was set to true" do
+       @result.each(:symbolize_keys => true) do |row|
+-        row.keys.first.class.should eql(Symbol)
++        expect(row.keys.first.class).to eql(Symbol)
+       end
+     end
+ 
+     it "should be able to return results as an array" do
+       @result.each(:as => :array) do |row|
+-        row.class.should eql(Array)
++        expect(row.class).to eql(Array)
+       end
+     end
+ 
+     it "should cache previously yielded results by default" do
+-      @result.first.object_id.should eql(@result.first.object_id)
++      expect(@result.first.object_id).to eql(@result.first.object_id)
+     end
+ 
+     it "should not cache previously yielded results if cache_rows is disabled" do
+       result = @client.query "SELECT 1", :cache_rows => false
+-      result.first.object_id.should_not eql(result.first.object_id)
++      expect(result.first.object_id).not_to eql(result.first.object_id)
+     end
+ 
+     it "should yield different value for #first if streaming" do
+       result = @client.query "SELECT 1 UNION SELECT 2", :stream => true, :cache_rows => false
+-      result.first.should_not eql(result.first)
++      expect(result.first).not_to eql(result.first)
+     end
+ 
+     it "should yield the same value for #first if streaming is disabled" do
+       result = @client.query "SELECT 1 UNION SELECT 2", :stream => false
+-      result.first.should eql(result.first)
++      expect(result.first).to eql(result.first)
+     end
+ 
+     it "should throw an exception if we try to iterate twice when streaming is enabled" do
+@@ -96,12 +96,12 @@ describe Mysql2::Result do
+     end
+ 
+     it "method should exist" do
+-      @test_result.should respond_to(:fields)
++      expect(@test_result).to respond_to(:fields)
+     end
+ 
+     it "should return an array of field names in proper order" do
+       result = @client.query "SELECT 'a', 'b', 'c'"
+-      result.fields.should eql(['a', 'b', 'c'])
++      expect(result.fields).to eql(['a', 'b', 'c'])
+     end
+   end
+ 
+@@ -109,28 +109,28 @@ describe Mysql2::Result do
+     it "should maintain a count while streaming" do
+       result = @client.query('SELECT 1')
+ 
+-      result.count.should eql(1)
++      expect(result.count).to eql(1)
+       result.each.to_a
+-      result.count.should eql(1)
++      expect(result.count).to eql(1)
+     end
+ 
+     it "should set the actual count of rows after streaming" do
+       result = @client.query("SELECT * FROM mysql2_test", :stream => true, :cache_rows => false)
+-      result.count.should eql(0)
++      expect(result.count).to eql(0)
+       result.each {|r|  }
+-      result.count.should eql(1)
++      expect(result.count).to eql(1)
+     end
+ 
+     it "should not yield nil at the end of streaming" do
+       result = @client.query('SELECT * FROM mysql2_test', :stream => true, :cache_rows => false)
+-      result.each { |r| r.should_not be_nil}
++      result.each { |r| expect(r).not_to be_nil}
+     end
+ 
+     it "#count should be zero for rows after streaming when there were no results" do
+       result = @client.query("SELECT * FROM mysql2_test WHERE null_test IS NOT NULL", :stream => true, :cache_rows => false)
+-      result.count.should eql(0)
++      expect(result.count).to eql(0)
+       result.each.to_a
+-      result.count.should eql(0)
++      expect(result.count).to eql(0)
+     end
+ 
+     it "should raise an exception if streaming ended due to a timeout" do
+@@ -147,12 +147,12 @@ describe Mysql2::Result do
+       client.query "SET net_write_timeout = 1"
+       res = client.query "SELECT * FROM streamingTest", :stream => true, :cache_rows => false
+ 
+-      lambda {
++      expect {
+         res.each_with_index do |row, i|
+           # Exhaust the first result packet then trigger a timeout
+           sleep 2 if i > 0 && i % 1000 == 0
+         end
+-      }.should raise_error(Mysql2::Error, /Lost connection/)
++      }.to raise_error(Mysql2::Error, /Lost connection/)
+     end
+   end
+ 
+@@ -163,32 +163,32 @@ describe Mysql2::Result do
+ 
+     it "should return nil values for NULL and strings for everything else when :cast is false" do
+       result = @client.query('SELECT null_test, tiny_int_test, bool_cast_test, int_test, date_test, enum_test FROM mysql2_test WHERE bool_cast_test = 1 LIMIT 1', :cast => false).first
+-      result["null_test"].should be_nil
+-      result["tiny_int_test"].should  eql("1")
+-      result["bool_cast_test"].should eql("1")
+-      result["int_test"].should       eql("10")
+-      result["date_test"].should      eql("2010-04-04")
+-      result["enum_test"].should      eql("val1")
++      expect(result["null_test"]).to be_nil
++      expect(result["tiny_int_test"]).to  eql("1")
++      expect(result["bool_cast_test"]).to eql("1")
++      expect(result["int_test"]).to       eql("10")
++      expect(result["date_test"]).to      eql("2010-04-04")
++      expect(result["enum_test"]).to      eql("val1")
+     end
+ 
+     it "should return nil for a NULL value" do
+-      @test_result['null_test'].class.should eql(NilClass)
+-      @test_result['null_test'].should eql(nil)
++      expect(@test_result['null_test'].class).to eql(NilClass)
++      expect(@test_result['null_test']).to eql(nil)
+     end
+ 
+     it "should return String for a BIT(64) value" do
+-      @test_result['bit_test'].class.should eql(String)
+-      @test_result['bit_test'].should eql("\000\000\000\000\000\000\000\005")
++      expect(@test_result['bit_test'].class).to eql(String)
++      expect(@test_result['bit_test']).to eql("\000\000\000\000\000\000\000\005")
+     end
+ 
+     it "should return String for a BIT(1) value" do
+-      @test_result['single_bit_test'].class.should eql(String)
+-      @test_result['single_bit_test'].should eql("\001")
++      expect(@test_result['single_bit_test'].class).to eql(String)
++      expect(@test_result['single_bit_test']).to eql("\001")
+     end
+ 
+     it "should return Fixnum for a TINYINT value" do
+-      [Fixnum, Bignum].should include(@test_result['tiny_int_test'].class)
+-      @test_result['tiny_int_test'].should eql(1)
++      expect([Fixnum, Bignum]).to include(@test_result['tiny_int_test'].class)
++      expect(@test_result['tiny_int_test']).to eql(1)
+     end
+ 
+     it "should return TrueClass or FalseClass for a TINYINT value if :cast_booleans is enabled" do
+@@ -202,9 +202,9 @@ describe Mysql2::Result do
+       result1 = @client.query 'SELECT bool_cast_test FROM mysql2_test WHERE bool_cast_test = 1 LIMIT 1', :cast_booleans => true
+       result2 = @client.query 'SELECT bool_cast_test FROM mysql2_test WHERE bool_cast_test = 0 LIMIT 1', :cast_booleans => true
+       result3 = @client.query 'SELECT bool_cast_test FROM mysql2_test WHERE bool_cast_test = -1 LIMIT 1', :cast_booleans => true
+-      result1.first['bool_cast_test'].should be_true
+-      result2.first['bool_cast_test'].should be_false
+-      result3.first['bool_cast_test'].should be_true
++      expect(result1.first['bool_cast_test']).to be_truthy
++      expect(result2.first['bool_cast_test']).to be_falsey
++      expect(result3.first['bool_cast_test']).to be_truthy
+ 
+       @client.query "DELETE from mysql2_test WHERE id IN(#{id1},#{id2},#{id3})"
+     end
+@@ -217,55 +217,55 @@ describe Mysql2::Result do
+ 
+       result1 = @client.query "SELECT single_bit_test FROM mysql2_test WHERE id = #{id1}", :cast_booleans => true
+       result2 = @client.query "SELECT single_bit_test FROM mysql2_test WHERE id = #{id2}", :cast_booleans => true
+-      result1.first['single_bit_test'].should be_true
+-      result2.first['single_bit_test'].should be_false
++      expect(result1.first['single_bit_test']).to be_truthy
++      expect(result2.first['single_bit_test']).to be_falsey
+ 
+       @client.query "DELETE from mysql2_test WHERE id IN(#{id1},#{id2})"
+     end
+ 
+     it "should return Fixnum for a SMALLINT value" do
+-      [Fixnum, Bignum].should include(@test_result['small_int_test'].class)
+-      @test_result['small_int_test'].should eql(10)
++      expect([Fixnum, Bignum]).to include(@test_result['small_int_test'].class)
++      expect(@test_result['small_int_test']).to eql(10)
+     end
+ 
+     it "should return Fixnum for a MEDIUMINT value" do
+-      [Fixnum, Bignum].should include(@test_result['medium_int_test'].class)
+-      @test_result['medium_int_test'].should eql(10)
++      expect([Fixnum, Bignum]).to include(@test_result['medium_int_test'].class)
++      expect(@test_result['medium_int_test']).to eql(10)
+     end
+ 
+     it "should return Fixnum for an INT value" do
+-      [Fixnum, Bignum].should include(@test_result['int_test'].class)
+-      @test_result['int_test'].should eql(10)
++      expect([Fixnum, Bignum]).to include(@test_result['int_test'].class)
++      expect(@test_result['int_test']).to eql(10)
+     end
+ 
+     it "should return Fixnum for a BIGINT value" do
+-      [Fixnum, Bignum].should include(@test_result['big_int_test'].class)
+-      @test_result['big_int_test'].should eql(10)
++      expect([Fixnum, Bignum]).to include(@test_result['big_int_test'].class)
++      expect(@test_result['big_int_test']).to eql(10)
+     end
+ 
+     it "should return Fixnum for a YEAR value" do
+-      [Fixnum, Bignum].should include(@test_result['year_test'].class)
+-      @test_result['year_test'].should eql(2009)
++      expect([Fixnum, Bignum]).to include(@test_result['year_test'].class)
++      expect(@test_result['year_test']).to eql(2009)
+     end
+ 
+     it "should return BigDecimal for a DECIMAL value" do
+-      @test_result['decimal_test'].class.should eql(BigDecimal)
+-      @test_result['decimal_test'].should eql(10.3)
++      expect(@test_result['decimal_test'].class).to eql(BigDecimal)
++      expect(@test_result['decimal_test']).to eql(10.3)
+     end
+ 
+     it "should return Float for a FLOAT value" do
+-      @test_result['float_test'].class.should eql(Float)
+-      @test_result['float_test'].should eql(10.3)
++      expect(@test_result['float_test'].class).to eql(Float)
++      expect(@test_result['float_test']).to eql(10.3)
+     end
+ 
+     it "should return Float for a DOUBLE value" do
+-      @test_result['double_test'].class.should eql(Float)
+-      @test_result['double_test'].should eql(10.3)
++      expect(@test_result['double_test'].class).to eql(Float)
++      expect(@test_result['double_test']).to eql(10.3)
+     end
+ 
+     it "should return Time for a DATETIME value when within the supported range" do
+-      @test_result['date_time_test'].class.should eql(Time)
+-      @test_result['date_time_test'].strftime("%Y-%m-%d %H:%M:%S").should eql('2010-04-04 11:44:00')
++      expect(@test_result['date_time_test'].class).to eql(Time)
++      expect(@test_result['date_time_test'].strftime("%Y-%m-%d %H:%M:%S")).to eql('2010-04-04 11:44:00')
+     end
+ 
+     if 1.size == 4 # 32bit
+@@ -278,61 +278,61 @@ describe Mysql2::Result do
+       it "should return DateTime when timestamp is < 1901-12-13 20:45:52" do
+                                       # 1901-12-13T20:45:52 is the min for 32bit Ruby 1.8
+         r = @client.query("SELECT CAST('1901-12-13 20:45:51' AS DATETIME) as test")
+-        r.first['test'].class.should eql(klass)
++        expect(r.first['test'].class).to eql(klass)
+       end
+ 
+       it "should return DateTime when timestamp is > 2038-01-19T03:14:07" do
+                                       # 2038-01-19T03:14:07 is the max for 32bit Ruby 1.8
+         r = @client.query("SELECT CAST('2038-01-19 03:14:08' AS DATETIME) as test")
+-        r.first['test'].class.should eql(klass)
++        expect(r.first['test'].class).to eql(klass)
+       end
+     elsif 1.size == 8 # 64bit
+       unless RUBY_VERSION =~ /1.8/
+         it "should return Time when timestamp is < 1901-12-13 20:45:52" do
+           r = @client.query("SELECT CAST('1901-12-13 20:45:51' AS DATETIME) as test")
+-          r.first['test'].class.should eql(Time)
++          expect(r.first['test'].class).to eql(Time)
+         end
+ 
+         it "should return Time when timestamp is > 2038-01-19T03:14:07" do
+           r = @client.query("SELECT CAST('2038-01-19 03:14:08' AS DATETIME) as test")
+-          r.first['test'].class.should eql(Time)
++          expect(r.first['test'].class).to eql(Time)
+         end
+       else
+         it "should return Time when timestamp is > 0138-12-31 11:59:59" do
+           r = @client.query("SELECT CAST('0139-1-1 00:00:00' AS DATETIME) as test")
+-          r.first['test'].class.should eql(Time)
++          expect(r.first['test'].class).to eql(Time)
+         end
+ 
+         it "should return DateTime when timestamp is < 0139-1-1T00:00:00" do
+           r = @client.query("SELECT CAST('0138-12-31 11:59:59' AS DATETIME) as test")
+-          r.first['test'].class.should eql(DateTime)
++          expect(r.first['test'].class).to eql(DateTime)
+         end
+ 
+         it "should return Time when timestamp is > 2038-01-19T03:14:07" do
+           r = @client.query("SELECT CAST('2038-01-19 03:14:08' AS DATETIME) as test")
+-          r.first['test'].class.should eql(Time)
++          expect(r.first['test'].class).to eql(Time)
+         end
+       end
+     end
+ 
+     it "should return Time for a TIMESTAMP value when within the supported range" do
+-      @test_result['timestamp_test'].class.should eql(Time)
+-      @test_result['timestamp_test'].strftime("%Y-%m-%d %H:%M:%S").should eql('2010-04-04 11:44:00')
++      expect(@test_result['timestamp_test'].class).to eql(Time)
++      expect(@test_result['timestamp_test'].strftime("%Y-%m-%d %H:%M:%S")).to eql('2010-04-04 11:44:00')
+     end
+ 
+     it "should return Time for a TIME value" do
+-      @test_result['time_test'].class.should eql(Time)
+-      @test_result['time_test'].strftime("%Y-%m-%d %H:%M:%S").should eql('2000-01-01 11:44:00')
++      expect(@test_result['time_test'].class).to eql(Time)
++      expect(@test_result['time_test'].strftime("%Y-%m-%d %H:%M:%S")).to eql('2000-01-01 11:44:00')
+     end
+ 
+     it "should return Date for a DATE value" do
+-      @test_result['date_test'].class.should eql(Date)
+-      @test_result['date_test'].strftime("%Y-%m-%d").should eql('2010-04-04')
++      expect(@test_result['date_test'].class).to eql(Date)
++      expect(@test_result['date_test'].strftime("%Y-%m-%d")).to eql('2010-04-04')
+     end
+ 
+     it "should return String for an ENUM value" do
+-      @test_result['enum_test'].class.should eql(String)
+-      @test_result['enum_test'].should eql('val1')
++      expect(@test_result['enum_test'].class).to eql(String)
++      expect(@test_result['enum_test']).to eql('val1')
+     end
+ 
+     it "should raise an error given an invalid DATETIME" do
+@@ -342,7 +342,7 @@ describe Mysql2::Result do
+         error = e
+       end
+ 
+-      error.message.should eql("Invalid date in field 'bad_datetime': 1972-00-27 00:00:00")
++      expect(error.message).to eql("Invalid date in field 'bad_datetime': 1972-00-27 00:00:00")
+     end
+ 
+     if defined? Encoding
+@@ -350,11 +350,11 @@ describe Mysql2::Result do
+         it "should default to the connection's encoding if Encoding.default_internal is nil" do
+           with_internal_encoding nil do
+             result = @client.query("SELECT * FROM mysql2_test ORDER BY id DESC LIMIT 1").first
+-            result['enum_test'].encoding.should eql(Encoding.find('utf-8'))
++            expect(result['enum_test'].encoding).to eql(Encoding.find('utf-8'))
+ 
+             client2 = Mysql2::Client.new(DatabaseCredentials['root'].merge(:encoding => 'ascii'))
+             result = client2.query("SELECT * FROM mysql2_test ORDER BY id DESC LIMIT 1").first
+-            result['enum_test'].encoding.should eql(Encoding.find('us-ascii'))
++            expect(result['enum_test'].encoding).to eql(Encoding.find('us-ascii'))
+             client2.close
+           end
+         end
+@@ -362,20 +362,20 @@ describe Mysql2::Result do
+         it "should use Encoding.default_internal" do
+           with_internal_encoding 'utf-8' do
+             result = @client.query("SELECT * FROM mysql2_test ORDER BY id DESC LIMIT 1").first
+-            result['enum_test'].encoding.should eql(Encoding.default_internal)
++            expect(result['enum_test'].encoding).to eql(Encoding.default_internal)
+           end
+ 
+           with_internal_encoding 'us-ascii' do
+             result = @client.query("SELECT * FROM mysql2_test ORDER BY id DESC LIMIT 1").first
+-            result['enum_test'].encoding.should eql(Encoding.default_internal)
++            expect(result['enum_test'].encoding).to eql(Encoding.default_internal)
+           end
+         end
+       end
+     end
+ 
+     it "should return String for a SET value" do
+-      @test_result['set_test'].class.should eql(String)
+-      @test_result['set_test'].should eql('val1,val2')
++      expect(@test_result['set_test'].class).to eql(String)
++      expect(@test_result['set_test']).to eql('val1,val2')
+     end
+ 
+     if defined? Encoding
+@@ -383,11 +383,11 @@ describe Mysql2::Result do
+         it "should default to the connection's encoding if Encoding.default_internal is nil" do
+           with_internal_encoding nil do
+             result = @client.query("SELECT * FROM mysql2_test ORDER BY id DESC LIMIT 1").first
+-            result['set_test'].encoding.should eql(Encoding.find('utf-8'))
++            expect(result['set_test'].encoding).to eql(Encoding.find('utf-8'))
+ 
+             client2 = Mysql2::Client.new(DatabaseCredentials['root'].merge(:encoding => 'ascii'))
+             result = client2.query("SELECT * FROM mysql2_test ORDER BY id DESC LIMIT 1").first
+-            result['set_test'].encoding.should eql(Encoding.find('us-ascii'))
++            expect(result['set_test'].encoding).to eql(Encoding.find('us-ascii'))
+             client2.close
+           end
+         end
+@@ -395,20 +395,20 @@ describe Mysql2::Result do
+         it "should use Encoding.default_internal" do
+           with_internal_encoding 'utf-8' do
+             result = @client.query("SELECT * FROM mysql2_test ORDER BY id DESC LIMIT 1").first
+-            result['set_test'].encoding.should eql(Encoding.default_internal)
++            expect(result['set_test'].encoding).to eql(Encoding.default_internal)
+           end
+ 
+           with_internal_encoding 'us-ascii' do
+             result = @client.query("SELECT * FROM mysql2_test ORDER BY id DESC LIMIT 1").first
+-            result['set_test'].encoding.should eql(Encoding.default_internal)
++            expect(result['set_test'].encoding).to eql(Encoding.default_internal)
+           end
+         end
+       end
+     end
+ 
+     it "should return String for a BINARY value" do
+-      @test_result['binary_test'].class.should eql(String)
+-      @test_result['binary_test'].should eql("test#{"\000"*6}")
++      expect(@test_result['binary_test'].class).to eql(String)
++      expect(@test_result['binary_test']).to eql("test#{"\000"*6}")
+     end
+ 
+     if defined? Encoding
+@@ -416,19 +416,19 @@ describe Mysql2::Result do
+         it "should default to binary if Encoding.default_internal is nil" do
+           with_internal_encoding nil do
+             result = @client.query("SELECT * FROM mysql2_test ORDER BY id DESC LIMIT 1").first
+-            result['binary_test'].encoding.should eql(Encoding.find('binary'))
++            expect(result['binary_test'].encoding).to eql(Encoding.find('binary'))
+           end
+         end
+ 
+         it "should not use Encoding.default_internal" do
+           with_internal_encoding 'utf-8' do
+             result = @client.query("SELECT * FROM mysql2_test ORDER BY id DESC LIMIT 1").first
+-            result['binary_test'].encoding.should eql(Encoding.find('binary'))
++            expect(result['binary_test'].encoding).to eql(Encoding.find('binary'))
+           end
+ 
+           with_internal_encoding 'us-ascii' do
+             result = @client.query("SELECT * FROM mysql2_test ORDER BY id DESC LIMIT 1").first
+-            result['binary_test'].encoding.should eql(Encoding.find('binary'))
++            expect(result['binary_test'].encoding).to eql(Encoding.find('binary'))
+           end
+         end
+       end
+@@ -448,8 +448,8 @@ describe Mysql2::Result do
+       'long_text_test' => 'LONGTEXT'
+     }.each do |field, type|
+       it "should return a String for #{type}" do
+-        @test_result[field].class.should eql(String)
+-        @test_result[field].should eql("test")
++        expect(@test_result[field].class).to eql(String)
++        expect(@test_result[field]).to eql("test")
+       end
+ 
+       if defined? Encoding
+@@ -458,30 +458,30 @@ describe Mysql2::Result do
+             it "should default to binary if Encoding.default_internal is nil" do
+               with_internal_encoding nil do
+                 result = @client.query("SELECT * FROM mysql2_test ORDER BY id DESC LIMIT 1").first
+-                result['binary_test'].encoding.should eql(Encoding.find('binary'))
++                expect(result['binary_test'].encoding).to eql(Encoding.find('binary'))
+               end
+             end
+ 
+             it "should not use Encoding.default_internal" do
+               with_internal_encoding 'utf-8' do
+                 result = @client.query("SELECT * FROM mysql2_test ORDER BY id DESC LIMIT 1").first
+-                result['binary_test'].encoding.should eql(Encoding.find('binary'))
++                expect(result['binary_test'].encoding).to eql(Encoding.find('binary'))
+               end
+ 
+               with_internal_encoding 'us-ascii' do
+                 result = @client.query("SELECT * FROM mysql2_test ORDER BY id DESC LIMIT 1").first
+-                result['binary_test'].encoding.should eql(Encoding.find('binary'))
++                expect(result['binary_test'].encoding).to eql(Encoding.find('binary'))
+               end
+             end
+           else
+             it "should default to utf-8 if Encoding.default_internal is nil" do
+               with_internal_encoding nil do
+                 result = @client.query("SELECT * FROM mysql2_test ORDER BY id DESC LIMIT 1").first
+-                result[field].encoding.should eql(Encoding.find('utf-8'))
++                expect(result[field].encoding).to eql(Encoding.find('utf-8'))
+ 
+                 client2 = Mysql2::Client.new(DatabaseCredentials['root'].merge(:encoding => 'ascii'))
+                 result = client2.query("SELECT * FROM mysql2_test ORDER BY id DESC LIMIT 1").first
+-                result[field].encoding.should eql(Encoding.find('us-ascii'))
++                expect(result[field].encoding).to eql(Encoding.find('us-ascii'))
+                 client2.close
+               end
+             end
+@@ -489,12 +489,12 @@ describe Mysql2::Result do
+             it "should use Encoding.default_internal" do
+               with_internal_encoding 'utf-8' do
+                 result = @client.query("SELECT * FROM mysql2_test ORDER BY id DESC LIMIT 1").first
+-                result[field].encoding.should eql(Encoding.default_internal)
++                expect(result[field].encoding).to eql(Encoding.default_internal)
+               end
+ 
+               with_internal_encoding 'us-ascii' do
+                 result = @client.query("SELECT * FROM mysql2_test ORDER BY id DESC LIMIT 1").first
+-                result[field].encoding.should eql(Encoding.default_internal)
++                expect(result[field].encoding).to eql(Encoding.default_internal)
+               end
+             end
+           end
diff --git a/debian/patches/series b/debian/patches/series
index 6f274c8..5c6feb9 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,4 @@ remove_rpath_compilation_flag.patch
 remove_rubygems_from_examples.patch
 #deactivate_failing_specs.patch
 cleanup_fork.patch
+port_to_rspec3.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-mysql2.git



More information about the Pkg-ruby-extras-commits mailing list