-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix french javascript pluralization rule and add specs for locale loa…
…ding
- Loading branch information
Showing
4 changed files
with
57 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
# 0.0.1.1 | ||
|
||
Fix syntax error in French Javascript pluralization rule. | ||
|
||
# 0.0.1.0 | ||
|
||
## New configuration system! | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
require 'spec_helper' | ||
|
||
describe 'locale files' do | ||
describe "cldr/plurals.rb" do | ||
AVAILABLE_LANGUAGE_CODES.each do |locale| | ||
describe "#{locale} plural rules" do | ||
it "defines the keys" do | ||
I18n.with_locale locale do | ||
expect { | ||
I18n.t 'i18n.plural.keys' | ||
}.to_not raise_error | ||
end | ||
end | ||
|
||
it "defines a valid pluralization function" do | ||
I18n.with_locale locale do | ||
expect { | ||
rule = I18n.t 'i18n.plural.rule', resolve: false | ||
rule.call(1) | ||
}.to_not raise_error | ||
end | ||
end | ||
|
||
it "defines a valid javascript pluralization function" do | ||
I18n.with_locale locale do | ||
expect { | ||
ExecJS.eval I18n.t('i18n.plural.js_rule') | ||
}.to_not raise_error | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
AVAILABLE_LANGUAGE_CODES.each do |locale| | ||
["diaspora/#{locale}.yml", | ||
"devise/devise.#{locale}.yml", | ||
"javascript/javascript.#{locale}.yml"].each do |file| | ||
describe file do | ||
it "has no syntax errors if it exists" do | ||
file = Rails.root.join("config", "locales", file) | ||
pending "Not yet available" unless File.exists? file | ||
expect { | ||
YAML.load_file file | ||
}.to_not raise_error | ||
end | ||
end | ||
end | ||
end | ||
end |