Method: Ndd::RSpec::Rails::Matchers::Model#have_a_translated_error
- Defined in:
- lib/ndd/rspec/rails/matchers/model.rb
#have_a_translated_error(error) ⇒ Ndd::RSpec::Rails::Matchers::Model::HaveATranslatedError
Ensure that an error on a model or an attribute has an associated translation.
More precisely, ensure that (with all parameters being snake case) one of
I18n.t(locale, "activerecord.errors.models.{class_name}.attributes.{attribute_name}.{error_key}")
I18n.t(locale, "activerecord.errors.models.{class_name}.{error_key}")
I18n.t(locale, "activerecord.errors.messages.{error_key}")
I18n.t(locale, "errors.attributes.{attribute_name}.{error_key}")
I18n.t(locale, "errors.messages.{error_key}")
returns a value for the default locale (i.e. I18n.default_locale) or all the available locales (i.e. I18n.available_locales).
67 68 69 |
# File 'lib/ndd/rspec/rails/matchers/model.rb', line 67 def have_a_translated_error(error) # rubocop:disable Style/PredicateName HaveATranslatedError.new(error) end |