forked from tigrish/i18n-spec
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add to LocaleFile#error when a file contains invalid pluralization keys
- Loading branch information
Showing
5 changed files
with
22 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 3 additions & 4 deletions
7
lib/i18n-spec/matchers/have_valid_pluralization_keys_matcher.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
RSpec::Matchers.define :have_valid_pluralization_keys do |expected| | ||
match do |actual| | ||
locale_file = I18nSpec::LocaleFile.new(actual) | ||
@invalid_keys = locale_file.invalid_pluralization_keys | ||
@invalid_keys.empty? | ||
@locale_file = I18nSpec::LocaleFile.new(actual) | ||
@locale_file.invalid_pluralization_keys.empty? | ||
end | ||
|
||
failure_message_for_should do |filepath| | ||
"expected #{filepath} to not include invalid pluralization keys :\n- " << @invalid_keys.join("\n- ") | ||
"expected #{filepath} to not include invalid pluralization keys :\n- " << @locale_file.errors[:invalid_pluralization_keys].join("\n- ") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters