-
-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #109 from jhawthorn/locales_all
Improve Locale.all and all_locales_options
- Loading branch information
Showing
6 changed files
with
94 additions
and
12 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
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
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,35 @@ | ||
require 'spec_helper' | ||
|
||
RSpec.describe SolidusI18n::LocaleHelper do | ||
describe '#all_locales_options' do | ||
subject { all_locales_options } | ||
|
||
it 'includes en' do | ||
is_expected.to include(["English (US)", :en]) | ||
end | ||
|
||
it 'includes ja' do | ||
is_expected.to include(["日本語 (ja-JP)", :ja]) | ||
end | ||
|
||
describe 'locales' do | ||
subject { all_locales_options.map(&:last) } | ||
|
||
it 'includes each locale only once' do | ||
is_expected.to match_array(subject.uniq) | ||
end | ||
|
||
it 'should match Locale.all' do | ||
is_expected.to match_array SolidusI18n::Locale.all | ||
end | ||
end | ||
|
||
describe 'locale presentation' do | ||
subject { all_locales_options.map(&:first) } | ||
|
||
it 'should all be unique' do | ||
is_expected.to match_array(subject.uniq) | ||
end | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
require 'spec_helper' | ||
|
||
RSpec.describe SolidusI18n::Locale do | ||
describe '.all' do | ||
subject { SolidusI18n::Locale.all } | ||
|
||
it "Contains all available Solidus locales" do | ||
# Add to this list when adding/removing locales | ||
expect(subject).to match_array %i[ | ||
en | ||
zh-CN | ||
cs | ||
zh-TW | ||
it | ||
nl | ||
da | ||
tr | ||
id | ||
ro | ||
pt-BR | ||
ja | ||
es | ||
fr | ||
de | ||
ru | ||
uk | ||
ko | ||
pt | ||
et | ||
sk | ||
pl | ||
nb | ||
fa | ||
fi | ||
en-NZ | ||
en-IN | ||
en-AU | ||
bg | ||
en-GB | ||
de-CH | ||
es-MX | ||
es-CL | ||
th | ||
ca | ||
vi | ||
sv | ||
es-EC | ||
lv | ||
sl-SI | ||
] | ||
end | ||
end | ||
end |