Sha256: 36a21eab1ea146bfc6581d0efadf9e0e317572b05dc0fa1b02ce0401f1dc8142

Contents?: true

Size: 517 Bytes

Versions: 15

Compression:

Stored size: 517 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.instance_of?(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

15 entries across 15 versions & 1 rubygems

Version Path
renalware-core-2.1.1 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.1.0 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.167 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.166 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.165 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.164 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.163 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.162 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.161 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.160 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.159 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.158 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.157 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.156 spec/support/matchers/validate_timeliness_of.rb
renalware-core-2.0.155 spec/support/matchers/validate_timeliness_of.rb