Project

nosql

0.0
No commit activity in last 3 years
No release in over 3 years
A simple ActiveRecord 'adapter' that raises on any call
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

 Project Readme

Nosql

A simple ActiveRecord 'adapter' that raises an exception whenever the database is used. This is to ensure unit tests do not integrate with a database.

When testing scopes and complex queries, applying a tag can disable this gem and replace the normal adapter implementation.

Write up on usage

Installation

Add this line to your application's Gemfile:

gem 'nosql'

And then execute:

$ bundle

Or install it yourself as:

$ gem install nosql

Usage

If you were using RSpec and tagged tests which did hit the datbase with ':db', then you could use the following.

config.around(:each, type: :model) do |example|
  if example.metadata[:db]
    Nosql::Connection.disable!
    example.run
  else
    Nosql::Connection.enable!
    example.run
    Nosql::Connection.disable!
  end
end

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Authors