Sha256: 49f91ed93095260ef180d75a3191b705a0ed43b781e07f5e7141296bb926852a

Contents?: true

Size: 522 Bytes

Versions: 1

Compression:

Stored size: 522 Bytes

Contents

# frozen_string_literal: true

require_relative "all_records_validator/version"

module RSpec
  module AllRecordsValidator
    def self.validate!(ignored_models: [], only_has_many: false)
      target_classes = ApplicationRecord.subclasses.reject {|klass| klass.abstract_class? || ignored_models.include?(klass) || (only_has_many && klass.reflect_on_all_associations(:has_many).blank?) }

      target_classes.each do |klass|
        klass.all.each do |obj|
          obj.validate!
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rspec-all_records_validator-0.0.9 lib/rspec/all_records_validator.rb