- Fork the project
- Clone your new fork:
git clone [email protected]:[USERNAME]/sanitized.git
- Change your working directory:
cd sanitized
- Change to the most recent version of Ruby
- Install the most recent Bundler:
gem install bundler
- Install the most recent Rake:
gem install rake
- Install the dependencies:
rake install
(this will take a while!) - Ensure all the tests are passing:
rake test_all
With Ruby versions below 3.0.0
, rake test_all
will test every version of ActiveRecord
from 5.0.0
onwards.
With Ruby version 3.0.0
and above, rake test_all
will test all ActiveRecord versions
from 6.1.0
onwards.
- Create your feature branch
git checkout -b new-feature-branch
- Write tests for your new feature
- Write your feature code
- Run the tests against the most recent ActiveRecord version
rake test_latest
- Check your new code is 100% tested:
rake coverage
- Run the tests against all versions of ActiveRecord
rake test_all
- Check your coding style passes:
rake rubo
- Check your documentation reads well:
rake docs
- Check that all the test pass with the latest version of Ruby
- Check that all the test pass with Ruby 2.5
- Commit your changes
git commit -am 'My New Feature'
- Push the new branch to GitHub
git push origin new-feature-branch
- Create a new Pull Request
To run individual tests, add the :test
tag to each definition...
it "returns the correct string for multiple options", :test do
...
end
...then run rake test_tagged
Alternatively, if you want full control, you will need the rspec command that instructs Appraisal to use the latest ActiveRecord version...
rake spec_command #=> "bundle exec appraisal active-record-6-1-0-rc1 rspec spec/"
...and then use it to run any test you wish:
bundle exec appraisal active-record-6-1-0-rc1 rspec spec/string/setters_spec:36
Although the gem requires ActiveModel, we use Appraisal to run tests against each individual version of ActiveRecord that the gem supports. This automaticvally includes ActiveModel and allows us to test the attribute API against an actual database.
We use SimpleCov to ensure test coverage for every line of code. Ensure your test coverage is at 100% before submitting a Pull request.
The coverage report can be generated and opened with: rake coverage
We use SDoc to produce the documentation. Ensure your method comments match the existing style.
Documentation can be generated and opened with: rake docs
We use RuboCop to enforce a consistent style in the codebase. Reading through the exisitng code first is a great way to get started.
Cops can be run with: rake rubo
Run tests against the latest ActiveRecord version.
rake test_latest
or the shortcut rake
Run tests against all ActiveRecord versions.
rake test_all
or the shortcut rake all
Run tagged tests against the latest ActiveRecord version.
rake test_tagged
or the shortcut rake tagged
Display the command to use for running individual tests.
rake spec_command
Install Appraisal dependencies.
rake install
Run test coverage and open report.
rake coverage
Generate documentation and open in browser.
rake doc
Run RuboCop.
rake rubo