Sha256: 1c4e7a98ca714e2187bddef4464d1ae238f43b4e4b9d34613bb34309825f9fe9

Contents?: true

Size: 481 Bytes

Versions: 1

Compression:

Stored size: 481 Bytes

Contents

# frozen_string_literal: true

require_relative "all_records_validator/version"

module RSpec
  module AllRecordsValidator
    def self.validate!(ignored_models: [])
      target_classes = ApplicationRecord.subclasses.reject {|klass| klass.abstract_class? || ignored_models.include?(klass) || 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.8 lib/rspec/all_records_validator.rb