The Thor-based scaffolder of custom ActiveModel validators with unit test and its support files.
The module is the part of [hexx] scaffolders collection.
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install hexx-validators
require "hexx-validators" ::::. %w( in_the_past -o allow_nil time_zone -e not_in_the_past )
Arguments and Options
The generator takes one argument (the name of the validator, such as
in_the_past) and two options:
-o- the names of validator options (such as allow_nil etc.).
-e- the names of error messages for I18n translations.
Depending on options the unit test spec will be pre-populated with combinations of options.
The generator creates:
- the validator (
app/validators/in_the_past.rb) by convention I follow, it will be namespaced correspondingly:
- the unit test specification
Tested under MRI rubies >= 2.1. Rubies under 2.1 aren't supported.
Uses [RSpec] 3.0+ for testing and [hexx-suit] for dev/test tools collection.
- Fork the project.
- Read the STYLEGUIDE.
- Make your feature addition or bug fix.
- Add tests for it. This is important so I don't break it in a future version unintentionally.
- Commit, do not mess with Rakefile or version (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
- Send me a pull request. Bonus points for topic branches.
See MIT LICENSE.