Forum: Ruby memcache wrapper testing

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
51763ff4e4c531c68326064bc13b84a6?d=identicon&s=25 David Weldon (5hundy)
on 2007-07-17 01:17
I have a wrapper class for memcache-client (adds a little extra
functionality for something specific I need). Does anyone have any good
ideas for how to do unit testing on it?

The issue I have is that the memcache will become full of data from each
functional test I run. It would be nice to have a "clean slate" each
time I run. To me, the obvious thing would be to start and stop a
memcached server for each of my tests, but that seems like a major pain.
Is there something I'm missing like a clear_memcache function or
something?

Thanks!
B8dbb1987e8e5318584865f880036796?d=identicon&s=25 Chris Wanstrath (defunkt)
on 2007-07-17 05:25
(Received via mailing list)
On 7/16/07, David Weldon <dweldon@gmail.com> wrote:

> I have a wrapper class for memcache-client (adds a little extra
> functionality for something specific I need). Does anyone have any good
> ideas for how to do unit testing on it?

Use mocks.  Check the cache_fu tests, which run against mocks and a
real memcached server.

http://require.errtheblog.com/plugins/browser/cache_fu
58479f76374a3ba3c69b9804163f39f4?d=identicon&s=25 Eric Hodel (Guest)
on 2007-07-17 10:34
(Received via mailing list)
On Jul 16, 2007, at 16:18, David Weldon wrote:

> pain.
> Is there something I'm missing like a clear_memcache function or
> something?

Look at how the memcache-client tests are written.  They never touch
a server.
This topic is locked and can not be replied to.