Menu

Home

Matthew Petricone

Goal:

Shorter Active Record validations and associations with RSpec, FactoryGirl, and shoulda support.

There's a good chance the gem at https://rubygems.org/gems/rails_model_stacker will be ahead of the sourceforge code.

To use:

Dependencies:

Rails >= 5.0.1
Ruby >= 2.3.3
gem 'factory_girl_rails'
gem 'shoulda-matchers', git:'https://github.com/thoughtbot/shoulda-matchers.git', branch: 'rails_5'

There's a good chance it works with Rais 4 and older ruby versions, but I have no intention of finding out.

Gemfile

    gem 'rails_model_stacker'

Active Record:

config/initializers/<any ruby file>
    require 'rails_model_stacker/rms'

Testing with Rspec, FactoryGirl, shoulda:

spec/spec_helper.rb or equivalent
    require 'rails_model_stacker/spec_stacker'
    require 'rails_model_stacker/factory_stacker'

Further Documentation

    rdoc lib
    http://www.rubydoc.info/gems/rails_model_stacker/