Sha256: b1e54050c2523351b0c05d621cae4839cdd8b0f6ae8dea1e5e2fd38a700596a2
Contents?: true
Size: 746 Bytes
Versions: 1
Compression:
Stored size: 746 Bytes
Contents
RSpec::Matchers.define :ensure_equality_of do |attribute| chain :to do |to| @to = to end match do |model| raise Exception if @to.nil? value = model.send(attribute) model.send("#{@to}=", !!value) model.valid? if model.errors.has_key?(attribute) model.errors[attribute].include?(I18n.t('errors.messages.equality', attr: @to)) end end failure_message do |model| I18n.t 'missing_validators.matchers.ensure_equality_of.failure_message_for_should', model: model.class, attr: attribute.inspect end failure_message_when_negated do |model| I18n.t 'missing_validators.matchers.ensure_equality_of.failure_message_for_should_not', model: model.class, attr: attribute.inspect end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
missing_validators-1.1.0 | lib/missing_validators/matchers/ensure_equality_of_matcher.rb |