Skip to content

Latest commit

 

History

History
64 lines (45 loc) · 1.52 KB

README.md

File metadata and controls

64 lines (45 loc) · 1.52 KB

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