Sha256: 3e0f69a31f0767dfdf1e1ff475590349b7204666bc17b2fea445cab5ccf0b0f5
Contents?: true
Size: 715 Bytes
Versions: 56
Compression:
Stored size: 715 Bytes
Contents
class FakeClient def initialize @data = {} @uploaded = {} @uploads = 0 @downloads = 0 end attr_reader :uploaded, :uploads, :downloads attr_accessor :delay, :error def []=(key, value) @data[key] = value end def download wait_for_delay raise_error_if_present @downloads += 1 yield @data.dup nil end def upload(data) wait_for_delay raise_error_if_present @uploaded.update(data) @uploads += 1 end def uploaded? @uploads > 0 end def downloaded? @downloads > 0 end private def wait_for_delay if delay sleep delay end end def raise_error_if_present if error raise error end end end
Version data entries
56 entries across 56 versions & 2 rubygems