Class: Ndd::RSpec::Rails::Matchers::TranslationMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/ndd/rspec/rails/matchers/translation_matcher.rb

Overview

Base class for matchers dealing with translation.

Instance Method Summary collapse

Constructor Details

#initializeTranslationMatcher

Set the locales to test to I18n.available_locales.


13
14
15
# File 'lib/ndd/rspec/rails/matchers/translation_matcher.rb', line 13

def initialize
  @tested_locales = I18n.available_locales
end

Instance Method Details

#in_available_localesObject

Set the locales to test to all the available locales (i.e. I18n.available_locales).

Returns:

  • self


19
20
21
22
# File 'lib/ndd/rspec/rails/matchers/translation_matcher.rb', line 19

def in_available_locales
  @tested_locales = I18n.available_locales
  self
end

#in_default_localeObject

Set the locales to test to the default locale (i.e. I18n.default_locale) only.

Returns:

  • self


26
27
28
29
# File 'lib/ndd/rspec/rails/matchers/translation_matcher.rb', line 26

def in_default_locale
  @tested_locales = [I18n.default_locale]
  self
end