Sha256: 52b0e66e8b4fe6426d75395682e223903d308f8caca0c2a3336e12a1bc7ae0fe

Contents?: true

Size: 627 Bytes

Versions: 2

Compression:

Stored size: 627 Bytes

Contents

RSpec::Matchers.define :ensure_valid_imei_format_of do |attribute|
  match do |model|
    model.send("#{attribute}=", "invalid.imei")
    model.valid?

    if model.errors.has_key?(attribute)
      model.errors[attribute].include?(I18n.t('errors.messages.imei'))
    end
  end

  failure_message_for_should do |model|
    I18n.t 'missing_validators.matchers.ensure_valid_imei_format_of.failure_message_for_should',
      model: model.class
  end

  failure_message_for_should_not do |model|
    I18n.t 'missing_validators.matchers.ensure_valid_imei_format_of.failure_message_for_should_not',
      model: model.class
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
missing_validators-0.9.1 lib/missing_validators/matchers/ensure_valid_imei_format_of.rb
missing_validators-0.9 lib/missing_validators/matchers/ensure_valid_imei_format_of.rb