Sha256: 409079279a3652a7f9374265d41ce9c2a514a82ac65662e65d1a1628e5999a55

Contents?: true

Size: 512 Bytes

Versions: 143

Compression:

Stored size: 512 Bytes

Contents

# frozen_string_literal: true

RSpec::Matchers.define :validate_timeliness_of do |attribute|
  match do |model|
    model._validators[attribute.to_sym].detect do |validator|
      validator.class == ActiveModel::Validations::TimelinessValidator &&
        validator.attributes.include?(attribute)
    end
  end

  failure_message do |_actual|
    "expect #{attribute} to validate timeliness of"
  end

  failure_message_when_negated do |_actual|
    "expect #{attribute} to not validate timeliness of"
  end
end

Version data entries

143 entries across 143 versions & 1 rubygems

Version Path
renalware-core-2.0.1 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.0 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.0.pre.rc13 spec/support/matchers/validate_timeliness_of.rb