Class: Qs::TestClient

Inherits:
Object
  • Object
show all
Includes:
Client
Defined in:
lib/qs/client.rb

Defined Under Namespace

Classes: PushedItem

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Client

included, new

Constructor Details

#initialize(*args) ⇒ TestClient

Returns a new instance of TestClient.



94
95
96
97
98
99
# File 'lib/qs/client.rb', line 94

def initialize(*args)
  super
  require 'hella-redis/connection_spy'
  @redis = HellaRedis::ConnectionSpy.new(self.redis_config)
  @pushed_items = []
end

Instance Attribute Details

#pushed_itemsObject (readonly)

Returns the value of attribute pushed_items.



92
93
94
# File 'lib/qs/client.rb', line 92

def pushed_items
  @pushed_items
end

Instance Method Details

#push(queue_name, payload) ⇒ Object



101
102
103
104
105
106
# File 'lib/qs/client.rb', line 101

def push(queue_name, payload)
  # attempt to serialize (and then throw away) the payload, this will error
  # on the developer if it can't be serialized
  Qs.serialize(payload)
  @pushed_items << PushedItem.new(queue_name, payload)
end

#reset!Object



108
109
110
# File 'lib/qs/client.rb', line 108

def reset!
  @pushed_items.clear
end