-
-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Locale.all and all_locales_options #109
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
56173ba
Add spec against SolidusI18n::Locale.all
jhawthorn 0c386db
Use I18n.available_locales in Locale.all
jhawthorn 4a839a3
Avoid duplicate :en locales in all_locales_options
jhawthorn ea9fa3f
Add specs for all_locales_options
jhawthorn 0a4451e
Ensure locales have unique names
jhawthorn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice and sweet 👌