Project

jamjar

0.0
No commit activity in last 3 years
No release in over 3 years
JamJar dynamically creates SQLite-backed, in memory, ActiveRecord models to help you test your ActiveRecord extensions.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 1.3.10
 Project Readme

Gem Version Build Status Code Climate

JamJar

JamJar dynamically creates ActiveRecord models, backed by in-memory SQLite, to help you test your ActiveRecord extensions.

Installation

Add this line to your application's Gemfile:

gem "jamjar"

And then execute:

$ bundle

Usage

To generate a new model, simply call:

JamJar.model

You can pass a block, which will be evaluated in the model's class context:

model = JamJar.model do
  def self.foo
    "bar"
  end
end

model.foo #=> "bar"

You can add columns to your model's table with column.

JamJar.model do
  column :foo, :string
end

You can pass any options for your column that are supported by Rails, as described in the Rails API Documentation.

JamJar.model do
  column :foo, :string, default: "bar"
end

Contributing

  1. Fork it
  2. Create a branch (git checkout -b super-foo)
  3. Add your feature and specs.
  4. Commit your changes (git commit -am 'Extra-super foo-matic.')
  5. Push to the branch (git push origin super-foo)
  6. Create new Pull Request