Skip to content

Commit

Permalink
Add a spec to test locale code formats are consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
AliSoftware committed Aug 10, 2021
1 parent 63f085f commit c44e44d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions spec/locales_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@
end
end

it 'has only valid codes for known locales' do
described_class.all.each do |locale|
expect(locale.glotpress || 'xx').to match(/^[a-z]{2,3}(-[a-z]{2})?$/)
expect(locale.android || 'xx-rYY').to match(/^[a-z]{2,3}(-r[A-Z]{2})?$/)
expect(locale.google_play || 'xx-YY').to match(/^[a-z]{2,3}(-[A-Z]{2})?$/)
expect(locale.app_store || 'xx-Yy').to match(/^[a-z]{2,3}(-[A-Za-z]{2,4})?$/)
expect(locale.ios || 'xx-Yy').to match(/^[a-z]{2,3}(-[A-Za-z]{2,4})?$/)
end
end

it 'returns exactly 16 Mag16 locales' do
expect(described_class.mag16.count).to eq(16)
end
Expand Down

0 comments on commit c44e44d

Please sign in to comment.