Last active
March 30, 2016 20:03
-
-
Save stevenspiel/b6913b7fd259a21eb6839c7f5554795f to your computer and use it in GitHub Desktop.
Tests that all ActiveRecord models are using paper_trail. It finds all classes that inherit from ActiveRecord::Base and checks to see if :paper_trail_options is defined on each one.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rails_helper' | |
describe 'paper_trail' do | |
before { Rails.application.eager_load! } | |
let(:excluded_classes) { [ActiveRecord::SchemaMigration, PaperTrail::Version, PaperTrail::VersionAssociation] } | |
let(:models) { ActiveRecord::Base.descendants - excluded_classes } | |
it 'is implemented in all ActiveRecord::Base models' do | |
expect(models).to all(respond_to(:paper_trail_options)) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment