Sha256: 01095d56c37e600ad38615f7c2f9e1d7db91781123f2ab2dcf960bc351c5ab33

Contents?: true

Size: 654 Bytes

Versions: 5

Compression:

Stored size: 654 Bytes

Contents

RSpec::Matchers.define :be_a_thorough_translation_of do |default_locale_filepath|
  match do |filepath|
    locale_file = I18nSpec::LocaleFile.new(filepath)
    default_locale = I18nSpec::LocaleFile.new(default_locale_filepath)

    @misses = default_locale.flattened_translations.select do |key, value|
      !@keys.include?(key) &&
        locale_file.flattened_translations[key] != "" &&
        locale_file.flattened_translations[key] == value
    end
    @misses.empty?
  end

  chain :except do |keys|
    @keys = keys
  end

  failure_message do |filepath|
    "expected #{filepath} to translate :\n- " << @misses.keys.sort.join("\n- ")
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
spree_mobility-1.4.0 spec/support/matchers/be_a_thorough_translation_of_matcher.rb
spree_mobility-1.3.0 spec/support/matchers/be_a_thorough_translation_of_matcher.rb
spree_mobility-1.2.0 spec/support/matchers/be_a_thorough_translation_of_matcher.rb
spree_mobility-1.1.0 spec/support/matchers/be_a_thorough_translation_of_matcher.rb
spree_mobility-1.0.0 spec/support/matchers/be_a_thorough_translation_of_matcher.rb