[DRE-commits] [ruby-stomp] 01/05: Add patches for basic RSpec3 support for the test suite (Closes: #795119)

Cédric Boutillier boutil at moszumanska.debian.org
Thu Aug 13 16:18:02 UTC 2015


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

boutil pushed a commit to branch master
in repository ruby-stomp.

commit 3312901505d586d9b80fb41d4009289e5e1c38ca
Author: Cédric Boutillier <boutil at debian.org>
Date:   Thu Aug 13 18:07:45 2015 +0200

    Add patches for basic RSpec3 support for the test suite (Closes: #795119)
---
 debian/patches/deactivate_spec_be_empty.patch |  16 +++
 debian/patches/rspec3.patch                   | 144 ++++++++++++++++++++++++++
 debian/patches/series                         |   2 +
 3 files changed, 162 insertions(+)

diff --git a/debian/patches/deactivate_spec_be_empty.patch b/debian/patches/deactivate_spec_be_empty.patch
new file mode 100644
index 0000000..3af6b8c
--- /dev/null
+++ b/debian/patches/deactivate_spec_be_empty.patch
@@ -0,0 +1,16 @@
+Description: deactivate failing test using private method
+Author: Cédric Boutillier <boutil at debian.org>
+Bug: https://github.com/stompgem/stomp/issues/114
+Last-Update: 2015-08-13
+
+--- a/spec/message_spec.rb
++++ b/spec/message_spec.rb
+@@ -7,7 +7,7 @@
+   context 'when initializing a new message' do
+ 
+     context 'with invalid parameters' do
+-      it 'should return an empty message when receiving an empty string or nil parameter' do
++      xit 'should return an empty message when receiving an empty string or nil parameter' do
+         message = Stomp::Message.new('')
+         message.should be_empty
+       end
diff --git a/debian/patches/rspec3.patch b/debian/patches/rspec3.patch
new file mode 100644
index 0000000..173b4bb
--- /dev/null
+++ b/debian/patches/rspec3.patch
@@ -0,0 +1,144 @@
+Description: Basic RSpec3 support
+Author: Cédric Boutillier <boutil at debian.org>
+Bug: https://github.com/stompgem/stomp/issues/114
+Bug-Debian: https://bugs.debian.org/795119
+Last-Update: 2015-08-13
+ 
+--- a/spec/spec_helper.rb
++++ b/spec/spec_helper.rb
+@@ -1,6 +1,7 @@
+ # -*- encoding: utf-8 -*-
+ 
+ require 'rspec'
++require 'rspec/its'
+ dir = File.dirname(__FILE__)
+ lib_path = File.expand_path("#{dir}/../lib")
+ $LOAD_PATH.unshift lib_path unless $LOAD_PATH.include?(lib_path)
+--- a/spec/client_shared_examples.rb
++++ b/spec/client_shared_examples.rb
+@@ -11,24 +11,24 @@
+ 
+   describe "the closed? method" do
+     it "should be false when the connection is open" do
+-      @mock_connection.stub!(:closed?).and_return(false)
++      @mock_connection.stub(:closed?).and_return(false)
+       @client.closed?.should == false
+     end
+ 
+     it "should be true when the connection is closed" do
+-      @mock_connection.stub!(:closed?).and_return(true)
++      @mock_connection.stub(:closed?).and_return(true)
+       @client.closed?.should == true
+     end
+   end
+ 
+   describe "the open? method" do
+     it "should be true when the connection is open" do
+-      @mock_connection.stub!(:open?).and_return(true)
++      @mock_connection.stub(:open?).and_return(true)
+       @client.open?.should == true
+     end
+ 
+     it "should be false when the connection is closed" do
+-      @mock_connection.stub!(:open?).and_return(false)
++      @mock_connection.stub(:open?).and_return(false)
+       @client.open?.should == false
+     end
+   end
+@@ -36,7 +36,7 @@
+   describe "the subscribe method" do
+ 
+     before(:each) do
+-      @mock_connection.stub!(:subscribe).and_return(true)
++      @mock_connection.stub(:subscribe).and_return(true)
+     end
+ 
+     it "should raise RuntimeError if not passed a block" do
+--- a/spec/connection_spec.rb
++++ b/spec/connection_spec.rb
+@@ -43,8 +43,8 @@
+     # clone() does a shallow copy, we want a deep one so we can garantee the hosts order
+     normal_parameters = Marshal::load(Marshal::dump(@parameters))
+ 
+-    @tcp_socket = mock(:tcp_socket, :close => nil, :puts => nil, :write => nil, :setsockopt => nil, :flush => true)
+-    TCPSocket.stub!(:open).and_return @tcp_socket
++    @tcp_socket = double(:tcp_socket, :close => nil, :puts => nil, :write => nil, :setsockopt => nil, :flush => true)
++    TCPSocket.stub(:open).and_return @tcp_socket
+     @connection = Stomp::Connection.new(normal_parameters)
+   end
+ 
+@@ -130,18 +130,18 @@
+       it "should be false if reliable is set to false" do
+         hash = @parameters.merge({:reliable => false })
+         connection = Stomp::Connection.new(hash)
+-        connection.instance_variable_get(:@reliable).should be_false
++        connection.instance_variable_get(:@reliable).should be false
+       end
+       
+       it "should be true if reliable is set to true" do
+         hash = @parameters.merge({:reliable => true })
+         connection = Stomp::Connection.new(hash)
+-        connection.instance_variable_get(:@reliable).should be_true
++        connection.instance_variable_get(:@reliable).should be true
+       end
+       
+       it "should be true if reliable is not set" do
+         connection = Stomp::Connection.new(@parameters)
+-        connection.instance_variable_get(:@reliable).should be_true
++        connection.instance_variable_get(:@reliable).should be true
+       end
+     end
+     
+@@ -284,9 +284,9 @@
+       
+       before(:each) do
+         ssl_parameters = {:hosts => [{:login => "login2", :passcode => "passcode2", :host => "remotehost", :ssl => true}]}
+-        @ssl_socket = mock(:ssl_socket, :puts => nil, :write => nil, 
++        @ssl_socket = double(:ssl_socket, :puts => nil, :write => nil, 
+           :setsockopt => nil, :flush => true)
+-        @ssl_socket.stub!(:sync_close=)
++        @ssl_socket.stub(:sync_close=)
+         
+         TCPSocket.should_receive(:open).and_return @tcp_socket
+         OpenSSL::SSL::SSLSocket.should_receive(:new).and_return(@ssl_socket)
+@@ -425,11 +425,11 @@
+   describe "when closing a socket" do
+     it "should close the tcp connection" do
+       @tcp_socket.should_receive(:close)
+-      @connection.__send__(:close_socket).should be_true # Use Object.__send__
++      @connection.__send__(:close_socket).should be true # Use Object.__send__
+     end
+     it "should ignore exceptions" do
+       @tcp_socket.should_receive(:close).and_raise "exception"
+-      @connection.__send__(:close_socket).should be_true # Use Object.__send__
++      @connection.__send__(:close_socket).should be true # Use Object.__send__
+     end
+   end
+ 
+@@ -438,11 +438,11 @@
+       host = @parameters[:hosts][0]
+       @connection = Stomp::Connection.new(host[:login], host[:passcode], host[:host], host[:port], reliable = true, 5, connect_headers = {})
+       @connection.instance_variable_set(:@connection_attempts, 10000)
+-      @connection.send(:max_reconnect_attempts?).should be_false
++      @connection.send(:max_reconnect_attempts?).should be false
+     end
+     it "should return false if max_reconnect_attempts = 0" do
+       @connection.instance_variable_set(:@connection_attempts, 10000)
+-      @connection.send(:max_reconnect_attempts?).should be_false
++      @connection.send(:max_reconnect_attempts?).should be false
+     end
+     it "should return true if connection attempts > max_reconnect_attempts" do
+       limit = 10000
+@@ -450,10 +450,10 @@
+       @connection = Stomp::Connection.new(@parameters)
+       
+       @connection.instance_variable_set(:@connection_attempts, limit-1)
+-      @connection.send(:max_reconnect_attempts?).should be_false
++      @connection.send(:max_reconnect_attempts?).should be false
+       
+       @connection.instance_variable_set(:@connection_attempts, limit)
+-      @connection.send(:max_reconnect_attempts?).should be_true
++      @connection.send(:max_reconnect_attempts?).should be true
+     end
+     # These should be raised for the user to deal with
+     it "should not rescue MaxReconnectAttempts" do
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..dfad593
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,2 @@
+rspec3.patch
+deactivate_spec_be_empty.patch

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



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