Fixtures for your Redis Database

Another week, another gem!

This time, you’ll be able to test your code that interacts with Redis much more easily and consistently, by resetting your Test Redis DB to a known state at the start of each test.

RedisFixtures is, as its name says, Fixtures for your Redis DB. If you are using Redis as more than a cache (and if you’re not, you absolutely should, Redis is awesome!), you’ll want to have a consistent initial database state for your tests.

RedisFixtures will run at the start of each of your tests, flush your test Redis DB, and load the data from the Fixture into it.

As for generating this fixture, if you’re using FixtureBuilder, then it couldn’t be easier. Simply call RedisFixtures.save_fixtures and the end of your factory block, and you’re in business!

If you’re using any other gems to generate your fixtures, basically do the equivalent thing for them.

RedisFixtures is compatible with Minitest, and I’ll be adding support for RSpec soon. If you’re using RSpec and would like to have fixtures for Redis, get in touch!

Happy testing!

78 comments

  1. trip0201
  2. You are so awesome! I don’t suppose I’ve read through a single thing like this before.
    So nice to find someone with some unique thoughts on this subject matter.
    Seriously.. thank you for starting this up. This web site is something that is required on the internet, someone with
    a little originality!

  3. Can I just say what a comfort to discover a person that actually understands what they’re talking about on the net.
    You actually know how to bring an issue to light and make it important.

    More people must read this and understand this side of your story.
    I can’t believe you’re not more popular given that you definitely possess the
    gift.

  4. You actually make it seem really easy together with your
    presentation but I in finding this topic to be really
    something that I believe I’d by no means understand.
    It kind of feels too complex and extremely large for me.
    I am looking ahead to your subsequent post, I’ll attempt to get the dangle
    of it!

  5. Excellent blog you have here but I was curious about if you knew of
    any forums that cover the same topics discussed here?
    I’d really like to be a part of community where I can get feedback from other knowledgeable
    individuals that share the same interest. If you have any recommendations, please let
    me know. Thanks!

  6. I would like to thank you for the efforts you’ve put in penning
    this blog. I am hoping to check out the same high-grade blog posts from you in the future
    as well. In fact, your creative writing abilities has inspired
    me to get my own, personal site now ;)

  7. Hi there very nice blog!! Man .. Beautiful .. Wonderful
    .. I’ll bookmark your site and take the feeds additionally?
    I’m glad to search out numerous useful information here in the publish, we’d like work out more
    techniques on this regard, thanks for sharing.
    . . . . .

  8. Aw, this was a really nice post. Finding the time and actual effort to create a top notch
    article… but what can I say… I procrastinate a lot and don’t manage to
    get anything done.

  9. First off I would like to say awesome blog! I had a quick question that I’d like to ask if
    you don’t mind. I was curious to find out how you center yourself
    and clear your head before writing. I’ve had
    a hard time clearing my thoughts in getting my thoughts out.
    I truly do take pleasure in writing but it just seems
    like the first 10 to 15 minutes are wasted just trying to figure out how to begin. Any ideas or tips?
    Kudos!

  10. ᴛʜᴀᴛ ɪs ʀᴇᴀʟʟʏ ᴀ ɢᴏᴏᴅ ᴛɪᴘ ᴇsᴘᴇᴄɪᴀʟʟʏ ᴛᴏ ᴛʜᴏsᴇ ғʀᴇsʜ ᴛᴏ ᴛʜᴇ ʙʟᴏɢɢɪɴɢ. sɪᴍᴘʟᴇ ʙᴜᴛ ᴠᴇʀʏ ᴀᴄᴄᴜʀᴀᴛᴇ ɪɴғᴏ… ᴍᴀɴʏ ᴛʜᴀɴᴋs ғᴏʀ sʜᴀʀɪɴɢ ᴛʜɪs ᴏɴᴇ. ᴀ ᴍᴜsᴛ ʀᴇᴀᴅ ᴘᴏsᴛ!

  11. I do consider all of the ideas you’ve presented on your post.
    They’re really convincing and can certainly work. Nonetheless, the posts are very short
    for beginners. May you please prolong them a little from next time?

    Thanks for the post.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">