Sha256: 448d233d5cc1caddf70ea9547940b64ca802e3da8a253e39a326d36967d802af

Contents?: true

Size: 432 Bytes

Versions: 2

Compression:

Stored size: 432 Bytes

Contents

# frozen_string_literal: true

require_relative "all_records_validator/version"

module RSpec
  module AllRecordsValidator
    def self.validate_all_objects(ignore_models: [])
      target_classes = ApplicationRecord.subclasses.reject {|klass| klass.abstract_class? || ignore_models.include?(klass) }

      target_classes.each do |klass|
        klass.all.each do |obj|
          yield(obj)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rspec-all_records_validator-0.0.6 lib/rspec/all_records_validator.rb
rspec-all_records_validator-0.0.5 lib/rspec/all_records_validator.rb