Hello community,

here is the log from the commit of package rubygem-bunny for openSUSE:Factory 
checked in at 2015-12-03 13:30:04
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-bunny (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-bunny.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-bunny"

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-bunny/rubygem-bunny.changes      
2015-08-05 06:50:33.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.rubygem-bunny.new/rubygem-bunny.changes 
2015-12-03 13:30:05.000000000 +0100
@@ -1,0 +2,64 @@
+Mon Nov  2 05:29:22 UTC 2015 - [email protected]
+
+- updated to version 2.2.1
+ see installed ChangeLog.md
+
+  ## Changes between Bunny 2.2.0 and 2.2.1
+  
+  ### No TLS Socket Double-init
+  
+  Makes sure that TLS sockets are not double-initialized.
+  
+  GH issue: [#345](https://github.com/ruby-amqp/bunny/issues/345).
+  
+  Contributed by Carl Hörberg.
+
+-------------------------------------------------------------------
+Sun Sep  6 04:29:00 UTC 2015 - [email protected]
+
+- updated to version 2.2.0
+ see installed ChangeLog.md
+
+  ## Changes between Bunny 2.1.0 and 2.2.0
+  
+  ### Add :addresses to connect options
+  
+  Before this the connection options only allowed multiple hosts, an
+  address is a combination of a host and a port. This makes it possible to
+  specify different hosts with different ports.
+  
+  ### Recover from connection.close by default
+  
+  Bunny will now try to reconnect also when server sent connection.close is
+  received, e.g. when a server is restarting (but also when the connection is
+  force closed by the server). This is in-line with how many other clients 
behave.
+  The old default was `recover_from_connection_close: false`.
+
+-------------------------------------------------------------------
+Mon Aug 17 04:29:43 UTC 2015 - [email protected]
+
+- updated to version 2.1.0
+ see installed ChangeLog.md
+
+-------------------------------------------------------------------
+Sat Aug  8 04:28:55 UTC 2015 - [email protected]
+
+- updated to version 2.0.1
+ see installed ChangeLog.md
+
+  ## Changes between Bunny 2.0.0 and 2.0.1
+  
+  ### Explicit Ruby 2.0 Requirement
+  
+  Bunny now requires Ruby 2.0 in the gemspec.
+  
+  Contributed by Carl Hörberg.
+  
+  ### JRuby Fix
+  
+  Bunny runs again on JRuby. Note that
+  JRuby users are strongly advised to use March Hare instead.
+  
+  Contributed by Teodor Pripoae.
+
+-------------------------------------------------------------------

Old:
----
  bunny-2.0.0.gem

New:
----
  bunny-2.2.1.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-bunny.spec ++++++
--- /var/tmp/diff_new_pack.s6jWWw/_old  2015-12-03 13:30:06.000000000 +0100
+++ /var/tmp/diff_new_pack.s6jWWw/_new  2015-12-03 13:30:06.000000000 +0100
@@ -24,13 +24,13 @@
 #
 
 Name:           rubygem-bunny
-Version:        2.0.0
+Version:        2.2.1
 Release:        0
 %define mod_name bunny
 %define mod_full_name %{mod_name}-%{version}
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
+BuildRequires:  %{ruby >= 2.0}
 BuildRequires:  %{rubygem gem2rpm}
-BuildRequires:  %{ruby}
 BuildRequires:  ruby-macros >= 5
 Url:            http://rubybunny.info
 Source:         http://rubygems.org/gems/%{mod_full_name}.gem

++++++ bunny-2.0.0.gem -> bunny-2.2.1.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ChangeLog.md new/ChangeLog.md
--- old/ChangeLog.md    2015-07-23 10:34:55.000000000 +0200
+++ new/ChangeLog.md    2015-11-01 20:46:43.000000000 +0100
@@ -1,3 +1,67 @@
+## Changes between Bunny 2.2.0 and 2.2.1
+
+### No TLS Socket Double-init
+
+Makes sure that TLS sockets are not double-initialized.
+
+GH issue: [#345](https://github.com/ruby-amqp/bunny/issues/345).
+
+Contributed by Carl Hörberg.
+
+
+
+## Changes between Bunny 2.1.0 and 2.2.0
+
+### Add :addresses to connect options
+
+Before this the connection options only allowed multiple hosts, an
+address is a combination of a host and a port. This makes it possible to
+specify different hosts with different ports.
+
+### Recover from connection.close by default
+
+Bunny will now try to reconnect also when server sent connection.close is
+received, e.g. when a server is restarting (but also when the connection is
+force closed by the server). This is in-line with how many other clients 
behave.
+The old default was `recover_from_connection_close: false`.
+
+## Changes between Bunny 2.0.0 and 2.1.0
+
+Bunny 2.1.0 has an **important breaking change**. It is highly
+advised that 2.1.0 is not mixed with earlier versions of Bunny
+in case your applications include **integers in message headers**.
+
+### Integer Value Serialisation in Headers
+
+Integer values in headers are now serialised as signed 64-bit integers. 
Previously
+they were serialised as 32-bit unsigned integers, causing both underflows
+and overflows: incorrect values were observed by consumers.
+
+It is highly
+advised that 2.1.0 is not mixed with earlier versions of Bunny
+in case your applications include integers in message headers.
+
+If that's not the case, Bunny 2.1 will integeroperate with any earlier version
+starting with 0.9.0 just fine. Popular clients in other languages
+(e.g. Java and .NET) will interoperate with Bunny 2.1.0 without
+issues.
+
+
+### Explicit Ruby 2.0 Requirement
+
+Bunny now requires Ruby 2.0 in the gemspec.
+
+Contributed by Carl Hörberg.
+
+### JRuby Fix
+
+Bunny runs again on JRuby. Note that
+JRuby users are strongly advised to use March Hare instead.
+
+Contributed by Teodor Pripoae.
+
+
+
 ## Changes between Bunny 1.7.0 and 2.0.0
 
 Bunny `2.0` doesn't have any breaking API changes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md       2015-07-23 10:34:55.000000000 +0200
+++ new/README.md       2015-11-01 20:46:43.000000000 +0100
@@ -49,7 +49,6 @@
 Modern Bunny versions support
 
  * CRuby 2.2, 2.1, 2.0
- * Rubinius 2.0+
 
 Bunny works sufficiently well on JRuby but there are known
 JRuby bugs that cause high CPU burn. JRuby users should
@@ -69,14 +68,6 @@
 Bunny is a mature library (started in early 2009) with
 a stable public API.
 
-Before version 0.9, **a lot** of functionality was missing.  Version
-0.9 can be considered to be a "second birthday" for Bunny as it was
-rewritten from scratch with over a dozen of preview releases over the
-course of about a year.
-
-We (the maintainers) made our best effort to keep the new version as
-backwards compatible as possible but within reason.
-
 
 ## Installation & Bundler Dependency
 
@@ -97,7 +88,7 @@
 To use Bunny in a project managed with Bundler:
 
 ``` ruby
-gem "bunny", ">= 1.7.0"
+gem "bunny", ">= 2.1.0"
 ```
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bunny.gemspec new/bunny.gemspec
--- old/bunny.gemspec   2015-07-23 10:34:55.000000000 +0200
+++ new/bunny.gemspec   2015-11-01 20:46:43.000000000 +0100
@@ -11,6 +11,7 @@
   s.summary = "Popular easy to use Ruby client for RabbitMQ"
   s.description = "Easy to use, feature complete Ruby client for RabbitMQ 3.3 
and later versions."
   s.license = "MIT"
+  s.required_ruby_version = Gem::Requirement.new(">= 2.0")
 
   # Sorted alphabetically.
   s.authors = [
@@ -20,16 +21,10 @@
     "Michael S. Klishin",
     "Stefan Kaes"]
 
-  s.email = [
-    "Y2VsbGRlZUBnbWFpbC5jb20=\n",
-    "ZXJpY0A1c3RvcHMuY29t\n",
-    "c3Rhc3RueUAxMDFpZGVhcy5jeg==\n",
-    "bWljaGFlbEBub3ZlbWJlcmFpbi5jb20=\n",
-    "c2thZXNAcmFpbHNleHByZXNzLmRl\n"].
-    map { |mail| Base64.decode64(mail) }
+  s.email = ["[email protected]"]
 
   # Dependencies
-  s.add_dependency "amq-protocol", ">= 1.9.2"
+  s.add_dependency "amq-protocol", ">= 2.0.0"
 
   # Files.
   s.has_rdoc = true
Files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/bunny/consumer_work_pool.rb 
new/lib/bunny/consumer_work_pool.rb
--- old/lib/bunny/consumer_work_pool.rb 2015-07-23 10:34:55.000000000 +0200
+++ new/lib/bunny/consumer_work_pool.rb 2015-11-01 20:46:43.000000000 +0100
@@ -19,6 +19,7 @@
     def initialize(size = 1)
       @size  = size
       @queue = ::Queue.new
+      @paused = false
     end
 
 
@@ -41,6 +42,14 @@
       @running
     end
 
+    def backlog
+      @queue.length
+    end
+
+    def busy?
+      [email protected]?
+    end
+
     def shutdown
       @running = false
 
@@ -57,12 +66,12 @@
 
     def pause
       @running = false
-
-      @threads.each { |t| t.stop }
+      @paused = true
     end
 
     def resume
       @running = true
+      @paused = false
 
       @threads.each { |t| t.run }
     end
@@ -78,6 +87,7 @@
     def run_loop
       catch(:terminate) do
         loop do
+          Thread.stop if @paused
           callable = @queue.pop
 
           begin
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/bunny/jruby/socket.rb 
new/lib/bunny/jruby/socket.rb
--- old/lib/bunny/jruby/socket.rb       2015-07-23 10:34:55.000000000 +0200
+++ new/lib/bunny/jruby/socket.rb       2015-11-01 20:46:43.000000000 +0100
@@ -5,7 +5,8 @@
     # TCP socket extension that uses Socket#readpartial to avoid excessive CPU
     # burn after some time. See issue #165.
     # @private
-    class Socket < Bunny::Socket
+    module Socket
+      include Bunny::Socket
 
       # Reads given number of bytes with an optional timeout
       #
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/bunny/session.rb new/lib/bunny/session.rb
--- old/lib/bunny/session.rb    2015-07-23 10:34:55.000000000 +0200
+++ new/lib/bunny/session.rb    2015-11-01 20:46:43.000000000 +0100
@@ -95,6 +95,7 @@
     #
     # @option connection_string_or_opts [String] :host ("127.0.0.1") Hostname 
or IP address to connect to
     # @option connection_string_or_opts [Array<String>] :hosts (["127.0.0.1"]) 
list of hostname or IP addresses to select hostname from when connecting
+    # @option connection_string_or_opts [Array<String>] :addresses 
(["127.0.0.1:5672"]) list of addresses to select hostname and port from when 
connecting
     # @option connection_string_or_opts [Integer] :port (5672) Port RabbitMQ 
listens on
     # @option connection_string_or_opts [String] :username ("guest") Username
     # @option connection_string_or_opts [String] :password ("guest") Password
@@ -113,8 +114,9 @@
     # @option connection_string_or_opts [IO, String] :log_file The file or 
path to use when creating a logger.  Defaults to STDOUT.
     # @option connection_string_or_opts [IO, String] :logfile DEPRECATED: use 
:log_file instead.  The file or path to use when creating a logger.  Defaults 
to STDOUT.
     # @option connection_string_or_opts [Integer] :log_level The log level to 
use when creating a logger.  Defaults to LOGGER::WARN
-    # @option connection_string_or_opts [Boolean] :automatically_recover 
Should automatically recover from network failures?
-    # @option connection_string_or_opts [Integer] :recovery_attempts Max 
number of recovery attempts
+    # @option connection_string_or_opts [Boolean] :automatically_recover 
(true) Should automatically recover from network failures?
+    # @option connection_string_or_opts [Integer] :recovery_attempts (nil) Max 
number of recovery attempts, nil means forever, 0 means never
+    # @option connection_string_or_opts [Boolean] 
:recover_from_connection_close (true) Recover from server-sent connection.close
     #
     # @option optz [String] :auth_mechanism ("PLAIN") Authentication 
mechanism, PLAIN or EXTERNAL
     # @option optz [String] :locale ("PLAIN") Locale RabbitMQ should use
@@ -135,10 +137,9 @@
       @default_hosts_shuffle_strategy = Proc.new { |hosts| hosts.shuffle }
 
       @opts            = opts
-      @hosts           = self.hostnames_from(opts)
-      @host_index      = 0
+      @addresses       = self.addresses_from(opts)
+      @address_index   = 0
 
-      @port            = self.port_from(opts)
       @user            = self.username_from(opts)
       @pass            = self.password_from(opts)
       @vhost           = self.vhost_from(opts)
@@ -148,6 +149,8 @@
       log_level        = opts[:log_level] || ENV["BUNNY_LOG_LEVEL"] || 
Logger::WARN
       @logger          = opts.fetch(:logger, init_default_logger(log_file, 
log_level))
 
+      validate_connection_options(opts)
+
       # should automatic recovery from network failures be used?
       @automatically_recover = if opts[:automatically_recover].nil? && 
opts[:automatic_recovery].nil?
                                  true
@@ -156,7 +159,7 @@
                                end
       @recovery_attempts     = opts[:recovery_attempts]
       @network_recovery_interval = opts.fetch(:network_recovery_interval, 
DEFAULT_NETWORK_RECOVERY_INTERVAL)
-      @recover_from_connection_close = 
opts.fetch(:recover_from_connection_close, false)
+      @recover_from_connection_close = 
opts.fetch(:recover_from_connection_close, true)
       # in ms
       @continuation_timeout   = opts.fetch(:continuation_timeout, 
DEFAULT_CONTINUATION_TIMEOUT)
 
@@ -183,7 +186,7 @@
       # the non-reentrant Ruby mutexes. MK.
       @transport_mutex     = @mutex_impl.new
       @status_mutex        = @mutex_impl.new
-      @host_index_mutex    = @mutex_impl.new
+      @address_index_mutex = @mutex_impl.new
 
       @channels            = Hash.new
 
@@ -193,6 +196,16 @@
       self.initialize_transport
     end
 
+    def validate_connection_options(options)
+      if options[:hosts] && options[:addresses]
+        raise ArgumentError, "Connection options can't contain hosts and 
addresses at the same time"
+      end
+
+      if (options[:host] || options[:hostname]) && (options[:hosts] || 
options[:addresses])
+        @logger.warn "The connection options contain both a host and an array 
of hosts, the single host is ignored."
+      end
+    end
+
     # @return [String] RabbitMQ hostname (or IP address) used
     def hostname;     self.host;  end
     # @return [String] Username used
@@ -223,11 +236,15 @@
     end
 
     def host
-      @transport ? @transport.host : @hosts[@host_index]
+      @transport ? @transport.host : 
host_from_address(@addresses[@address_index])
     end
 
-    def reset_host_index
-      @host_index_mutex.synchronize { @host_index = 0 }
+    def port
+      @transport ? @transport.port : 
port_from_address(@addresses[@address_index])
+    end
+
+    def reset_address_index
+      @address_index_mutex.synchronize { @address_index = 0 }
     end
 
     # @private
@@ -293,7 +310,7 @@
           raise
         end
       rescue HostListDepleted
-        self.reset_host_index
+        self.reset_address_index
         @status_mutex.synchronize { @status = :not_connected }
         raise TCPConnectionFailedForAllHosts
       end
@@ -659,7 +676,7 @@
           recover_channels
         end
       rescue HostListDepleted
-        reset_host_index
+        reset_address_index
         retry
       rescue TCPConnectionFailedForAllHosts, TCPConnectionFailed, 
AMQ::Protocol::EmptyResponseError => e
         @logger.warn "TCP connection failed, reconnecting in 
#{@network_recovery_interval} seconds"
@@ -744,10 +761,23 @@
     end
 
     # @private
-    def hostnames_from(options)
-      options.fetch(:hosts_shuffle_strategy, 
@default_hosts_shuffle_strategy).call(
-        [ options[:hosts] || options[:host] || options[:hostname] || 
DEFAULT_HOST ].flatten
-      )
+    def addresses_from(options)
+      shuffle_strategy = options.fetch(:hosts_shuffle_strategy, 
@default_hosts_shuffle_strategy)
+
+      addresses = options[:host] || options[:hostname] || options[:addresses] 
||
+        options[:hosts] || ["#{DEFAULT_HOST}:#{port_from(options)}"]
+      addresses = [addresses] unless addresses.is_a? Array
+
+      addresses.map! do |address|
+        host_with_port?(address) ? address : "#{address}:#{port_from(@opts)}"
+      end
+
+      shuffle_strategy.call addresses
+    end
+
+    # @private
+    def host_with_port?(address)
+      address.include? ':'
     end
 
     # @private
@@ -762,6 +792,16 @@
     end
 
     # @private
+    def host_from_address(address)
+      address.split(":")[0]
+    end
+
+    # @private
+    def port_from_address(address)
+      address.split(":")[1].to_i
+    end
+
+    # @private
     def vhost_from(options)
       options[:virtual_host] || options[:vhost] || DEFAULT_VHOST
     end
@@ -946,7 +986,7 @@
     # @api public
     def to_s
       oid = ("0x%x" % (self.object_id << 1))
-      "#<#{self.class.name}:#{oid} #{@user}@#{host}:#{@port}, vhost=#{@vhost}, 
hosts=[#{@hosts.join(',')}]>"
+      "#<#{self.class.name}:#{oid} #{@user}@#{host}:#{port}, vhost=#{@vhost}, 
addresses=[#{@addresses.join(',')}]>"
     end
 
     def inspect
@@ -1109,10 +1149,14 @@
 
     # @private
     def initialize_transport
-      if host = @hosts[ @host_index ]
-        @host_index_mutex.synchronize { @host_index += 1 }
+      if address = @addresses[ @address_index ]
+        @address_index_mutex.synchronize { @address_index += 1 }
         @transport.close rescue nil # Let's make sure the previous transport 
socket is closed
-        @transport = Transport.new(self, host, @port, 
@opts.merge(:session_thread => @origin_thread))
+        @transport = Transport.new(self,
+                                   host_from_address(address),
+                                   port_from_address(address),
+                                   @opts.merge(:session_thread => 
@origin_thread)
+                                  )
 
         # Reset the cached progname for the logger only when no logger was 
provided
         @default_logger.progname = self.to_s
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/bunny/transport.rb new/lib/bunny/transport.rb
--- old/lib/bunny/transport.rb  2015-07-23 10:34:55.000000000 +0200
+++ new/lib/bunny/transport.rb  2015-11-01 20:46:43.000000000 +0100
@@ -292,7 +292,7 @@
     end
 
     def post_initialize_socket
-      @socket = if uses_tls?
+      @socket = if uses_tls? and [email protected]_a?(Bunny::SSLSocketImpl)
                   wrap_in_tls_socket(@socket)
                 else
                   @socket
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/bunny/version.rb new/lib/bunny/version.rb
--- old/lib/bunny/version.rb    2015-07-23 10:34:55.000000000 +0200
+++ new/lib/bunny/version.rb    2015-11-01 20:46:43.000000000 +0100
@@ -2,5 +2,5 @@
 
 module Bunny
   # @return [String] Version of the library
-  VERSION = "2.0.0"
+  VERSION = "2.2.1"
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2015-07-23 10:34:55.000000000 +0200
+++ new/metadata        2015-11-01 20:46:43.000000000 +0100
@@ -1,7 +1,7 @@
 --- !ruby/object:Gem::Specification
 name: bunny
 version: !ruby/object:Gem::Version
-  version: 2.0.0
+  version: 2.2.1
 platform: ruby
 authors:
 - Chris Duncan
@@ -12,7 +12,7 @@
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2015-07-23 00:00:00.000000000 Z
+date: 2015-11-01 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: amq-protocol
@@ -20,22 +20,18 @@
     requirements:
     - - ">="
       - !ruby/object:Gem::Version
-        version: 1.9.2
+        version: 2.0.0
   type: :runtime
   prerelease: false
   version_requirements: !ruby/object:Gem::Requirement
     requirements:
     - - ">="
       - !ruby/object:Gem::Version
-        version: 1.9.2
+        version: 2.0.0
 description: Easy to use, feature complete Ruby client for RabbitMQ 3.3 and 
later
   versions.
 email:
-- [email protected]
-- [email protected]
-- [email protected]
-- [email protected]
-- [email protected]
+- [email protected]
 executables: []
 extensions: []
 extra_rdoc_files:
@@ -224,7 +220,7 @@
   requirements:
   - - ">="
     - !ruby/object:Gem::Version
-      version: '0'
+      version: '2.0'
 required_rubygems_version: !ruby/object:Gem::Requirement
   requirements:
   - - ">="
@@ -232,7 +228,7 @@
       version: '0'
 requirements: []
 rubyforge_project: 
-rubygems_version: 2.4.6
+rubygems_version: 2.4.8
 signing_key: 
 specification_version: 4
 summary: Popular easy to use Ruby client for RabbitMQ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/higher_level_api/integration/connection_spec.rb 
new/spec/higher_level_api/integration/connection_spec.rb
--- old/spec/higher_level_api/integration/connection_spec.rb    2015-07-23 
10:34:55.000000000 +0200
+++ new/spec/higher_level_api/integration/connection_spec.rb    2015-11-01 
20:46:43.000000000 +0100
@@ -19,7 +19,6 @@
       end
     end
 
-
     it "handles amqp:// URIs w/o path part" do
       session = described_class.new("amqp://127.0.0.1")
       session.start
@@ -32,7 +31,6 @@
       session.close
     end
 
-
     context "when URI ends in a slash" do
       it "parses vhost as an empty string" do
         session = described_class.new("amqp://127.0.0.1/")
@@ -50,9 +48,6 @@
     end
   end
 
-
-
-
   context "initialized with all defaults" do
     it "provides a way to fine tune socket options" do
       conn = Bunny.new
@@ -156,7 +151,7 @@
       let(:hosts)   { [host] }
       let(:subject) { described_class.new(:hosts => hosts) }
 
-      it "uses hostname = localhost" do
+      it "uses hostname = 192.168.1.10" do
         expect(subject.host).to eq host
         expect(subject.hostname).to eq host
       end
@@ -171,6 +166,58 @@
       end
     end
 
+    context "initialized with :addresses => [...]" do
+      after :each do
+        subject.close if subject.open?
+      end
+
+      let(:host)      { "192.168.1.10" }
+      let(:port)      { 5673 }
+      let(:address)   { "#{host}:#{port}" }
+      let(:addresses) { [address] }
+      let(:subject)   { described_class.new(:addresses => addresses) }
+
+      it "uses hostname = 192.168.1.10" do
+        expect(subject.host).to eq host
+        expect(subject.hostname).to eq host
+      end
+
+      it "uses port 5673" do
+        expect(subject.port).to eq port
+      end
+
+      it "uses username = guest" do
+        expect(subject.username).to eq username
+        expect(subject.user).to eq username
+      end
+    end
+
+    context "initialized with conflicting hosts and addresses" do
+      let(:host)      { "192.168.1.10" }
+      let(:port)      { 5673 }
+      let(:address)   { "#{host}:#{port}" }
+      let(:io)        { StringIO.new }
+      let(:logger)    { ::Logger.new(io) }
+
+      it "raises an argument error when there is are hosts and an address" do
+        expect { described_class.new(addresses: [address], hosts: [host]) }.to 
raise_error(ArgumentError)
+      end
+
+      it "logs a warning when there is a single host and an array" do
+        described_class.new(addresses: [address], host: host, logger: logger)
+        expect(io.string).to include 'WARN -- : The connection options contain 
'\
+          'both a host and an array of hosts, the single host is ignored.'
+      end
+
+      it "converts hosts in addresses to addresses" do
+        strategy = Proc.new { |addresses| addresses }
+        session = described_class.new(addresses: [address,host ], 
hosts_shuffle_strategy: strategy)
+        strategy = Proc.new { |addresses| addresses }
+
+        expect(session.to_s).to include 
'addresses=[192.168.1.10:5673,192.168.1.10:5672]'
+      end
+    end
+
     context "initialized with :channel_max => 4096" do
       after :each do
         subject.close if subject.open?
@@ -223,7 +270,6 @@
     end
   end
 
-
   context "initialized with :host => 127.0.0.1 and non-default credentials" do
     after :each do
       subject.close if subject.open?
@@ -276,7 +322,6 @@
     end
   end
 
-
   context "initialized with :host => 127.0.0.1 and non-default credentials 
(take 2)" do
     after :each do
       subject.close if subject.open?
@@ -324,8 +369,6 @@
     end
   end
 
-
-
   context "initialized with :host => 127.0.0.1 and non-default credentials 
(take 2)" do
     after :each do
       subject.close if subject.open?
@@ -362,8 +405,6 @@
     end
   end
 
-
-
   context "initialized with :host => 127.0.0.1 and INVALID credentials" do
     let(:host)     { "127.0.0.1" }
     # see ./bin/ci/before_build
@@ -390,7 +431,6 @@
     end
   end
 
-
   context "initialized with unreachable host or port" do
     it "fails to connect" do
       expect do
@@ -422,13 +462,12 @@
     end
   end
 
-
   context "initialized with a custom logger object" do
     let(:io)      { StringIO.new }
     let(:logger)  { ::Logger.new(io) }
 
     it "uses provided logger" do
-      conn = described_class.new(:hostname => "localhost", :logger => logger)
+      conn = described_class.new(:logger => logger)
       conn.start
 
       expect(io.string.length).to be > 100
@@ -438,7 +477,7 @@
 
     it "doesn't reassign the logger's progname attribute" do
       expect(logger).not_to receive(:progname=)
-      described_class.new(:hostname => "localhost", :logger => logger)
+      described_class.new(:logger => logger)
     end
   end
 end


Reply via email to