Skip to content

Instantly share code, notes, and snippets.

@ryansch
Created August 1, 2014 02:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryansch/6f5920e87e95ac7052b9 to your computer and use it in GitHub Desktop.
Save ryansch/6f5920e87e95ac7052b9 to your computer and use it in GitHub Desktop.
This needs metaprogramming.
class FakeRedis
new: =>
@called = {}
set_timeout: (...) =>
@called.set_timeout = ...
true
connect: (...) =>
@called.connect = ...
true
multi: (...) =>
@called.multi = ...
true
sadd: (...) =>
@called.sadd = ...
true
lpush: (...) =>
@called.lpush = ...
true
exec: (...) =>
@called.exec = ...
true
set_keepalive: (...) =>
@called.set_keepalive = ...
true
get_called: =>
@called
{ :FakeRedis }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment