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.45 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.44 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.43 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.42 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.41 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.40 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.39 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.38 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.37 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.36 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.35 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.34 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.33 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.32 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.31 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.30 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.28 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.27 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.26 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.25 spec/support/matchers/validate_timeliness_of.rb