Class: Bunny::Testing
- Inherits:
-
Object
- Object
- Bunny::Testing
- Includes:
- Singleton
- Defined in:
- lib/bunny/testing.rb,
lib/bunny/testing/version.rb
Constant Summary collapse
- VERSION =
"0.2.0"
Instance Attribute Summary collapse
-
#exchanges ⇒ Object
readonly
Returns the value of attribute exchanges.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Testing
constructor
A new instance of Testing.
- #queue(exchange:, routing_key: nil) ⇒ Object
- #reset_queue! ⇒ Object
Constructor Details
#initialize ⇒ Testing
Returns a new instance of Testing.
26 27 28 |
# File 'lib/bunny/testing.rb', line 26 def initialize reset_queue! end |
Instance Attribute Details
#exchanges ⇒ Object (readonly)
Returns the value of attribute exchanges.
10 11 12 |
# File 'lib/bunny/testing.rb', line 10 def exchanges @exchanges end |
Class Method Details
.exchanges ⇒ Object
13 14 15 |
# File 'lib/bunny/testing.rb', line 13 def exchanges instance.exchanges end |
.queue(exchange:, routing_key: nil) ⇒ Object
17 18 19 |
# File 'lib/bunny/testing.rb', line 17 def queue(exchange:, routing_key: nil) instance.queue(exchange: exchange, routing_key: routing_key) end |
.reset_queue! ⇒ Object
21 22 23 |
# File 'lib/bunny/testing.rb', line 21 def reset_queue! instance.reset_queue! end |
Instance Method Details
#queue(exchange:, routing_key: nil) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/bunny/testing.rb', line 30 def queue(exchange:, routing_key: nil) = exchanges[exchange] return .find_all { || [:routing_key] == routing_key } unless routing_key.nil? end |
#reset_queue! ⇒ Object
38 39 40 |
# File 'lib/bunny/testing.rb', line 38 def reset_queue! @exchanges = Hash.new { |hash, key| hash[key] = [] } end |