Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rocking_chair

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rocking_chair

  • 0.4.6
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

An in-memory CouchDB implementation in Ruby for couchrest and SimplyStored. Works for the database and document API, by_attribute views, and for SimplyStored generated views. This way your tests will no longer depend on CouchDB and can run against an in-memory database.

It intercepts the HTTP-API calls of couchrest by implementing a HTTPAdapter for couchrest. It then delegates those calls to the in-memory database.

The in-memory database a hash of document_id => JSON-object.

RockingChair support simple views like all_docs or by_attribute. Further, it should supports all the views generated by SimplyStored. So it supports associations and soft deletion.

Installation

gem install rocking_chair

Usage

Require the gem in your tests, e.g. test_helper.rb in Rails:

require 'rocking_chair'

Then activate it:

RockingChair.enable

Make sure to reset it every now and then so that your testdata doesn't grow too much. Put this e.g. in your setup block:

def setup
  RockingChair::Server.reset
end

If you have tests where you want to run against the real CouchDB, just deactivate RockingChair:

RockingChair.disable

You can also make RockingChair dump all requests:

RockingChair.enable_debug

and

RockingChair.disable_debug

Caveats

At the moment the performance is not as good as it could be as there is a lot of serialization to and from JSON going on. This will be improved by storing not only the JSON tree but also the Ruby representation of the stored objects.

License

RockingChair is licensed under the OpenBSD / two-clause BSD license, modeled after the ISC license. See LICENSE.txt

About

RockingChair was written by Jonathan Weiss to make Mathias Meyer happy.

FAQs

Package last updated on 31 Aug 2011

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc