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.



145
146
147
148
149
150
# File 'lib/qs/client.rb', line 145

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

Instance Attribute Details

#pushed_itemsObject (readonly)

Returns the value of attribute pushed_items.



143
144
145
# File 'lib/qs/client.rb', line 143

def pushed_items
  @pushed_items
end

Instance Method Details

#push(queue_name, payload_hash) ⇒ Object



152
153
154
155
156
157
# File 'lib/qs/client.rb', line 152

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

#reset!Object



159
160
161
# File 'lib/qs/client.rb', line 159

def reset!
  @pushed_items.clear
end