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.24 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.23 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.22 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.21 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.20 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.18 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.17 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.16 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.15 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.14 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.13 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.12 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.11 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.9 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.8 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.7 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.5 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.4 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.3 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.2 spec/support/matchers/validate_timeliness_of.rb