forked from iancanderson/ingreedy
-
Notifications
You must be signed in to change notification settings - Fork 8
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 #10 from cookpad/horiso/add-continuous-language-op…
…tion Add continuous language option
- Loading branch information
Showing
8 changed files
with
137 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
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,9 @@ | ||
module Ingreedy | ||
module ContinuousLanguageLocale | ||
CONTINUOUS_LANGUAGES_LOCALES = %i(ja th zh-TW) | ||
|
||
def use_whitespace?(locale) | ||
!CONTINUOUS_LANGUAGES_LOCALES.include?(locale) | ||
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
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,23 @@ | ||
require 'ingreedy/continuous_language_locale' | ||
|
||
RSpec.describe Ingreedy::ContinuousLanguageLocale do | ||
include Ingreedy::ContinuousLanguageLocale | ||
|
||
describe '#use_whitespace?' do | ||
context 'when the locale is a continuous language' do | ||
it 'returns false' do | ||
expect(use_whitespace?(:ja)).to be_falsey | ||
expect(use_whitespace?(:th)).to be_falsey | ||
expect(use_whitespace?(:'zh-TW')).to be_falsey | ||
end | ||
end | ||
|
||
context 'when the locale is not a continuous language' do | ||
it 'returns true' do | ||
expect(use_whitespace?(:en)).to be_truthy | ||
expect(use_whitespace?(:fr)).to be_truthy | ||
expect(use_whitespace?(:'zh-CN')).to be_truthy | ||
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