lib/bunny_mock/session.rb in bunny-mock-1.2.2 vs lib/bunny_mock/session.rb in bunny-mock-1.3.0
- old
+ new
@@ -1,10 +1,9 @@
# frozen_string_literal: true
module BunnyMock
# Mocks Bunny::Session
class Session
-
#
# API
#
# @return [Symbol] Current session status
@@ -19,11 +18,10 @@
##
# Creates a new {BunnyMock::Session} instance
#
# @api public
def initialize(*)
-
# not connected until {BunnyMock::Session#start} is called
@status = :not_connected
# create channel hash
@channels = {}
@@ -37,24 +35,21 @@
# Sets status to connected
#
# @return [BunnyMock::Session] self
# @api public
def start
-
@status = :connected
-
self
end
##
# Sets status to closed
#
# @return [BunnyMock::Session] self
# @api public
def stop
@status = :closed
-
self
end
alias close stop
##
@@ -92,10 +87,9 @@
# @param [Integer] pool_size Work pool size (insignificant)
#
# @return [BunnyMock::Channel] Channel instance
# @api public
def create_channel(n = nil, _pool_size = 1)
-
# raise same error as {Bunny::Session#create_channel}
raise ArgumentError, 'channel number 0 is reserved in the protocol and cannot be used' if n == 0
# return cached channel if exists
return @channels[n] if n && @channels.key?(n)