i18n_plus 0.3.5 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/i18n_plus/country.rb +5 -3
- data/lib/i18n_plus/currency.rb +5 -3
- data/lib/i18n_plus/language.rb +5 -3
- data/lib/i18n_plus/locale.rb +5 -3
- data/lib/i18n_plus/state.rb +8 -5
- data/lib/i18n_plus/version.rb +1 -1
- data/test/country_test.rb +6 -31
- data/test/currency_test.rb +6 -31
- data/test/language_test.rb +6 -31
- data/test/locale_test.rb +6 -31
- data/test/state_test.rb +11 -20
- metadata +13 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72cdf760645b9225c7187c939946e577646cdbce67c5fcfe6d34709a48ec5ef9
|
4
|
+
data.tar.gz: fabceece305f25de7bf6aca5b70913e6e1b31f9a376858706ffbd2e45a82043e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b9651f0e4ab00e5977fd89abd55be4d0e925b33814d3cb6ce08d28282e9301e678fe353e63d435c8701803026d79ccb256ea1a042cb26bb5809e612162f43b7
|
7
|
+
data.tar.gz: 8a161566cd89fc3a5e88e8dd18953f76e3aa7db519eb846860abd1591d0d51e914e3f8eb683a9b7bdc72dbda5b937931f7675ce860c08959e52d6f5b06f82fdd
|
data/CHANGELOG.md
CHANGED
data/lib/i18n_plus/country.rb
CHANGED
@@ -46,10 +46,12 @@ module ActionView
|
|
46
46
|
|
47
47
|
module ToCountrySelectTag
|
48
48
|
def to_country_select_tag(priority_country_codes, options, html_options)
|
49
|
-
|
49
|
+
options.symbolize_keys!
|
50
|
+
html_options.stringify_keys!
|
50
51
|
add_default_name_and_id(html_options)
|
51
|
-
value =
|
52
|
-
|
52
|
+
_, value = option_text_and_value(object)
|
53
|
+
selected_value = options.has_key?(:selected) ? options[:selected] : value
|
54
|
+
opts = add_options(country_options_for_select(selected_value, *priority_country_codes), options, value)
|
53
55
|
content_tag(:select, opts, html_options)
|
54
56
|
end
|
55
57
|
end
|
data/lib/i18n_plus/currency.rb
CHANGED
@@ -46,10 +46,12 @@ module ActionView
|
|
46
46
|
|
47
47
|
module ToCurrencySelectTag
|
48
48
|
def to_currency_select_tag(priority_currency_codes, options, html_options)
|
49
|
-
|
49
|
+
options.symbolize_keys!
|
50
|
+
html_options.stringify_keys!
|
50
51
|
add_default_name_and_id(html_options)
|
51
|
-
value =
|
52
|
-
|
52
|
+
_, value = option_text_and_value(object)
|
53
|
+
selected_value = options.has_key?(:selected) ? options[:selected] : value
|
54
|
+
opts = add_options(currency_options_for_select(selected_value, *priority_currency_codes), options, value)
|
53
55
|
content_tag(:select, opts, html_options)
|
54
56
|
end
|
55
57
|
end
|
data/lib/i18n_plus/language.rb
CHANGED
@@ -47,10 +47,12 @@ module ActionView
|
|
47
47
|
|
48
48
|
module ToLanguageSelectTag
|
49
49
|
def to_language_select_tag(priority_language_codes, options, html_options)
|
50
|
-
|
50
|
+
options.symbolize_keys!
|
51
|
+
html_options.stringify_keys!
|
51
52
|
add_default_name_and_id(html_options)
|
52
|
-
value =
|
53
|
-
|
53
|
+
_, value = option_text_and_value(object)
|
54
|
+
selected_value = options.has_key?(:selected) ? options[:selected] : value
|
55
|
+
opts = add_options(language_options_for_select(selected_value, *priority_language_codes), options, value)
|
54
56
|
content_tag(:select, opts, html_options)
|
55
57
|
end
|
56
58
|
end
|
data/lib/i18n_plus/locale.rb
CHANGED
@@ -46,10 +46,12 @@ module ActionView
|
|
46
46
|
|
47
47
|
module ToLocaleSelectTag
|
48
48
|
def to_locale_select_tag(priority_locale_codes, options, html_options)
|
49
|
-
|
49
|
+
options.symbolize_keys!
|
50
|
+
html_options.stringify_keys!
|
50
51
|
add_default_name_and_id(html_options)
|
51
|
-
value =
|
52
|
-
|
52
|
+
_, value = option_text_and_value(object)
|
53
|
+
selected_value = options.has_key?(:selected) ? options[:selected] : value
|
54
|
+
opts = add_options(locale_options_for_select(selected_value, *priority_locale_codes), options, value)
|
53
55
|
content_tag(:select, opts, html_options)
|
54
56
|
end
|
55
57
|
end
|
data/lib/i18n_plus/state.rb
CHANGED
@@ -31,17 +31,20 @@ module ActionView
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def state_options_for_select(country_code, selected = nil)
|
34
|
-
|
35
|
-
|
34
|
+
collection = I18nPlus.states(country_code)
|
35
|
+
options = collection.map { |code,name| [name, code] }.sort
|
36
|
+
options_for_select(options, selected)
|
36
37
|
end
|
37
38
|
end
|
38
39
|
|
39
40
|
module ToStateSelectTag
|
40
41
|
def to_state_select_tag(country_code, options, html_options)
|
41
|
-
|
42
|
+
options.symbolize_keys!
|
43
|
+
html_options.stringify_keys!
|
42
44
|
add_default_name_and_id(html_options)
|
43
|
-
value =
|
44
|
-
|
45
|
+
_, value = option_text_and_value(object)
|
46
|
+
selected_value = options.has_key?(:selected) ? options[:selected] : value
|
47
|
+
opts = add_options(state_options_for_select(country_code, selected_value), options, value)
|
45
48
|
content_tag(:select, opts, html_options)
|
46
49
|
end
|
47
50
|
end
|
data/lib/i18n_plus/version.rb
CHANGED
data/test/country_test.rb
CHANGED
@@ -41,57 +41,32 @@ class CountryTest < ActiveSupport::TestCase
|
|
41
41
|
|
42
42
|
test "should return country options for German" do
|
43
43
|
I18n.locale = :de
|
44
|
-
|
45
|
-
if ActiveSupport::VERSION::STRING < '4.0'
|
46
|
-
match = /<option value="DE" selected="selected">Deutschland<\/option>/
|
47
|
-
else
|
48
|
-
match = /<option selected="selected" value="DE">Deutschland<\/option>/
|
49
|
-
end
|
44
|
+
match = /<option selected="selected" value="DE">Deutschland<\/option>/
|
50
45
|
assert_match match, country_options_for_select('DE').gsub(/\n/, '')
|
51
46
|
end
|
52
47
|
|
53
48
|
test "should return country options for English" do
|
54
49
|
I18n.locale = :en
|
55
|
-
|
56
|
-
if ActiveSupport::VERSION::STRING < '4.0'
|
57
|
-
match = /<option value="DE" selected="selected">Germany<\/option>/
|
58
|
-
else
|
59
|
-
match = /<option selected="selected" value="DE">Germany<\/option>/
|
60
|
-
end
|
50
|
+
match = /<option selected="selected" value="DE">Germany<\/option>/
|
61
51
|
assert_match match, country_options_for_select('DE').gsub(/\n/, '')
|
62
52
|
end
|
63
53
|
|
64
54
|
test "should return country options with priority countries for English" do
|
65
55
|
I18n.locale = :en
|
66
|
-
|
67
|
-
if ActiveSupport::VERSION::STRING < '4.0'
|
68
|
-
match = /<option value="DE" selected="selected">Germany<\/option><option value="" disabled="disabled">----------<\/option>/
|
69
|
-
else
|
70
|
-
match = /<option selected="selected" value="DE">Germany<\/option><option value="" disabled="disabled">----------<\/option>/
|
71
|
-
end
|
56
|
+
match = /<option selected="selected" value="DE">Germany<\/option><option value="" disabled="disabled">----------<\/option>/
|
72
57
|
assert_match match, country_options_for_select('DE', 'DE').gsub(/\n/, '')
|
73
58
|
end
|
74
59
|
|
75
60
|
test "should return country options with multiple priority countries for English" do
|
76
61
|
I18n.locale = :en
|
77
|
-
|
78
|
-
if ActiveSupport::VERSION::STRING < '4.0'
|
79
|
-
match = /<option value="DE" selected="selected">Germany<\/option><option value=\"GB\">United Kingdom<\/option><option value="" disabled="disabled">----------<\/option>/
|
80
|
-
else
|
81
|
-
match = /<option selected="selected" value="DE">Germany<\/option><option value=\"GB\">United Kingdom<\/option><option value="" disabled="disabled">----------<\/option>/
|
82
|
-
end
|
62
|
+
match = /<option selected="selected" value="DE">Germany<\/option><option value=\"GB\">United Kingdom<\/option><option value="" disabled="disabled">----------<\/option>/
|
83
63
|
assert_match match, country_options_for_select('DE', 'DE', 'GB').gsub(/\n/, '')
|
84
64
|
end
|
85
65
|
|
86
66
|
test "should return country_select" do
|
87
67
|
I18n.locale = :en
|
88
|
-
|
89
|
-
|
90
|
-
match = /<select id="account_country" name="account\[country\]"><option value="DE" selected="selected">Germany<\/option><option value="" disabled="disabled">----------<\/option>/
|
91
|
-
else
|
92
|
-
match = /<select name="account\[country\]" id="account_country"><option selected="selected" value="DE">Germany<\/option><option value="" disabled="disabled">----------<\/option>/
|
93
|
-
end
|
94
|
-
assert_match match, country_select(@account, :country, 'DE').gsub(/\n/, '')
|
68
|
+
match = /<select name="account\[country\]" id="account_country"><option selected="selected" value="DE">Germany<\/option><option value="" disabled="disabled">----------<\/option>/
|
69
|
+
assert_match match, country_select(@account, :country, 'DE', {selected: 'DE'}).gsub(/\n/, '')
|
95
70
|
end
|
96
71
|
|
97
72
|
test "should return norway" do
|
data/test/currency_test.rb
CHANGED
@@ -16,56 +16,31 @@ class CurrencyTest < ActiveSupport::TestCase
|
|
16
16
|
|
17
17
|
test "should return currency options for German" do
|
18
18
|
I18n.locale = :de
|
19
|
-
|
20
|
-
if ActiveSupport::VERSION::STRING < '4.0'
|
21
|
-
match = /<option value="EUR" selected="selected">EUR \(€\)<\/option>/
|
22
|
-
else
|
23
|
-
match = /<option selected="selected" value="EUR">EUR \(€\)<\/option>/
|
24
|
-
end
|
19
|
+
match = /<option selected="selected" value="EUR">EUR \(€\)<\/option>/
|
25
20
|
assert_match match, currency_options_for_select('EUR').gsub(/\n/, '')
|
26
21
|
end
|
27
22
|
|
28
23
|
test "should return currency options for English" do
|
29
24
|
I18n.locale = :en
|
30
|
-
|
31
|
-
if ActiveSupport::VERSION::STRING < '4.0'
|
32
|
-
match = /<option value="EUR" selected="selected">EUR \(€\)<\/option>/
|
33
|
-
else
|
34
|
-
match = /<option selected="selected" value="EUR">EUR \(€\)<\/option>/
|
35
|
-
end
|
25
|
+
match = /<option selected="selected" value="EUR">EUR \(€\)<\/option>/
|
36
26
|
assert_match match, currency_options_for_select('EUR').gsub(/\n/, '')
|
37
27
|
end
|
38
28
|
|
39
29
|
test "should return currency options with priority currencies for English" do
|
40
30
|
I18n.locale = :en
|
41
|
-
|
42
|
-
if ActiveSupport::VERSION::STRING < '4.0'
|
43
|
-
match = /<option value="EUR" selected="selected">EUR \(€\)<\/option><option value="" disabled="disabled">----------<\/option>/
|
44
|
-
else
|
45
|
-
match = /<option selected="selected" value="EUR">EUR \(€\)<\/option><option value="" disabled="disabled">----------<\/option>/
|
46
|
-
end
|
31
|
+
match = /<option selected="selected" value="EUR">EUR \(€\)<\/option><option value="" disabled="disabled">----------<\/option>/
|
47
32
|
assert_match match, currency_options_for_select('EUR', 'EUR').gsub(/\n/, '')
|
48
33
|
end
|
49
34
|
|
50
35
|
test "should return currency options with multiple priority currencies for English" do
|
51
36
|
I18n.locale = :en
|
52
|
-
|
53
|
-
if ActiveSupport::VERSION::STRING < '4.0'
|
54
|
-
match = /<option value="EUR" selected="selected">EUR \(€\)<\/option><option value=\"USD\">USD \(\$\)<\/option><option value="" disabled="disabled">----------<\/option>/
|
55
|
-
else
|
56
|
-
match = /<option selected="selected" value="EUR">EUR \(€\)<\/option><option value=\"USD\">USD \(\$\)<\/option><option value="" disabled="disabled">----------<\/option>/
|
57
|
-
end
|
37
|
+
match = /<option selected="selected" value="EUR">EUR \(€\)<\/option><option value=\"USD\">USD \(\$\)<\/option><option value="" disabled="disabled">----------<\/option>/
|
58
38
|
assert_match match, currency_options_for_select('EUR', 'EUR', 'USD').gsub(/\n/, '')
|
59
39
|
end
|
60
40
|
|
61
41
|
test "should return currency_select" do
|
62
42
|
I18n.locale = :en
|
63
|
-
|
64
|
-
|
65
|
-
match = /<select id="account_currency" name="account\[currency\]"><option value="EUR" selected="selected">EUR \(€\)<\/option><option value="" disabled="disabled">----------<\/option>/
|
66
|
-
else
|
67
|
-
match = /<select name="account\[currency\]" id="account_currency"><option selected="selected" value="EUR">EUR \(€\)<\/option><option value="" disabled="disabled">----------<\/option>/
|
68
|
-
end
|
69
|
-
assert_match match, currency_select(@account, :currency, 'EUR').gsub(/\n/, '')
|
43
|
+
match = /<select name="account\[currency\]" id="account_currency"><option selected="selected" value="EUR">EUR \(€\)<\/option><option value="" disabled="disabled">----------<\/option>/
|
44
|
+
assert_match match, currency_select(@account, :currency, 'EUR', {selected: 'EUR'}).gsub(/\n/, '')
|
70
45
|
end
|
71
46
|
end
|
data/test/language_test.rb
CHANGED
@@ -14,57 +14,32 @@ class LanguageTest < ActiveSupport::TestCase
|
|
14
14
|
|
15
15
|
test "should return language options for German" do
|
16
16
|
I18n.locale = :de
|
17
|
-
|
18
|
-
if ActiveSupport::VERSION::STRING < '4.0'
|
19
|
-
match = /<option value="DE" selected="selected">Deutsch<\/option>/
|
20
|
-
else
|
21
|
-
match = /<option selected="selected" value="DE">Deutsch<\/option>/
|
22
|
-
end
|
17
|
+
match = /<option selected="selected" value="DE">Deutsch<\/option>/
|
23
18
|
assert_match match, language_options_for_select('DE').gsub(/\n/, '')
|
24
19
|
end
|
25
20
|
|
26
21
|
test "should return language options for English" do
|
27
22
|
I18n.locale = :en
|
28
|
-
|
29
|
-
if ActiveSupport::VERSION::STRING < '4.0'
|
30
|
-
match = /<option value="DE" selected="selected">German<\/option>/
|
31
|
-
else
|
32
|
-
match = /<option selected="selected" value="DE">German<\/option>/
|
33
|
-
end
|
23
|
+
match = /<option selected="selected" value="DE">German<\/option>/
|
34
24
|
assert_match match, language_options_for_select('DE').gsub(/\n/, '')
|
35
25
|
end
|
36
26
|
|
37
27
|
test "should return language options with priority languages for English" do
|
38
28
|
I18n.locale = :en
|
39
|
-
|
40
|
-
if ActiveSupport::VERSION::STRING < '4.0'
|
41
|
-
match = /<option value="DE" selected="selected">German<\/option><option value="" disabled="disabled">----------<\/option>/
|
42
|
-
else
|
43
|
-
match = /<option selected="selected" value="DE">German<\/option><option value="" disabled="disabled">----------<\/option>/
|
44
|
-
end
|
29
|
+
match = /<option selected="selected" value="DE">German<\/option><option value="" disabled="disabled">----------<\/option>/
|
45
30
|
assert_match match, language_options_for_select('DE', 'DE').gsub(/\n/, '')
|
46
31
|
end
|
47
32
|
|
48
33
|
test "should return language options with multiple priority languages for English" do
|
49
34
|
I18n.locale = :en
|
50
|
-
|
51
|
-
if ActiveSupport::VERSION::STRING < '4.0'
|
52
|
-
match = /<option value="DE" selected="selected">German<\/option><option value=\"EN\">English<\/option><option value="" disabled="disabled">----------<\/option>/
|
53
|
-
else
|
54
|
-
match = /<option selected="selected" value="DE">German<\/option><option value=\"EN\">English<\/option><option value="" disabled="disabled">----------<\/option>/
|
55
|
-
end
|
35
|
+
match = /<option selected="selected" value="DE">German<\/option><option value=\"EN\">English<\/option><option value="" disabled="disabled">----------<\/option>/
|
56
36
|
assert_match match, language_options_for_select('DE', 'DE', 'EN').gsub(/\n/, '')
|
57
37
|
end
|
58
38
|
|
59
39
|
test "should return language_select" do
|
60
40
|
I18n.locale = :en
|
61
|
-
|
62
|
-
|
63
|
-
match = /<select id="account_language" name="account\[language\]"><option value="DE" selected="selected">German<\/option><option value="" disabled="disabled">----------<\/option>/
|
64
|
-
else
|
65
|
-
match = /<select name="account\[language\]" id="account_language"><option selected="selected" value="DE">German<\/option><option value="" disabled="disabled">----------<\/option>/
|
66
|
-
end
|
67
|
-
assert_match match, language_select(@account, :language, 'DE').gsub(/\n/, '')
|
41
|
+
match = /<select name="account\[language\]" id="account_language"><option selected="selected" value="DE">German<\/option><option value="" disabled="disabled">----------<\/option>/
|
42
|
+
assert_match match, language_select(@account, :language, 'DE', {selected: 'DE'}).gsub(/\n/, '')
|
68
43
|
end
|
69
44
|
|
70
45
|
test "should return Norwegian" do
|
data/test/locale_test.rb
CHANGED
@@ -14,56 +14,31 @@ class LocaleTest < ActiveSupport::TestCase
|
|
14
14
|
|
15
15
|
test "should return locale options for German" do
|
16
16
|
I18n.locale = :de
|
17
|
-
|
18
|
-
if ActiveSupport::VERSION::STRING < '4.0'
|
19
|
-
match = /<option value="de-DE" selected="selected">Deutsch \(Deutschland\)<\/option>/
|
20
|
-
else
|
21
|
-
match = /<option selected="selected" value="de-DE">Deutsch \(Deutschland\)<\/option>/
|
22
|
-
end
|
17
|
+
match = /<option selected="selected" value="de-DE">Deutsch \(Deutschland\)<\/option>/
|
23
18
|
assert_match match, locale_options_for_select('de-DE').gsub(/\n/, '')
|
24
19
|
end
|
25
20
|
|
26
21
|
test "should return locale options for English" do
|
27
22
|
I18n.locale = :en
|
28
|
-
|
29
|
-
if ActiveSupport::VERSION::STRING < '4.0'
|
30
|
-
match = /<option value="de-DE" selected="selected">German \(Germany\)<\/option>/
|
31
|
-
else
|
32
|
-
match = /<option selected="selected" value="de-DE">German \(Germany\)<\/option>/
|
33
|
-
end
|
23
|
+
match = /<option selected="selected" value="de-DE">German \(Germany\)<\/option>/
|
34
24
|
assert_match match, locale_options_for_select('de-DE').gsub(/\n/, '')
|
35
25
|
end
|
36
26
|
|
37
27
|
test "should return locale options with priority locale for English" do
|
38
28
|
I18n.locale = :en
|
39
|
-
|
40
|
-
if ActiveSupport::VERSION::STRING < '4.0'
|
41
|
-
match = /<option value="de-DE" selected="selected">German \(Germany\)<\/option><option value="" disabled="disabled">----------<\/option>/
|
42
|
-
else
|
43
|
-
match = /<option selected="selected" value="de-DE">German \(Germany\)<\/option><option value="" disabled="disabled">----------<\/option>/
|
44
|
-
end
|
29
|
+
match = /<option selected="selected" value="de-DE">German \(Germany\)<\/option><option value="" disabled="disabled">----------<\/option>/
|
45
30
|
assert_match match, locale_options_for_select('de-DE', 'de-DE').gsub(/\n/, '')
|
46
31
|
end
|
47
32
|
|
48
33
|
test "should return locale options with multiple priority locales for English" do
|
49
34
|
I18n.locale = :en
|
50
|
-
|
51
|
-
if ActiveSupport::VERSION::STRING < '4.0'
|
52
|
-
match = /<option value="de-DE" selected="selected">German \(Germany\)<\/option><option value=\"en-GB\">English \(United Kingdom\)<\/option><option value="" disabled="disabled">----------<\/option>/
|
53
|
-
else
|
54
|
-
match = /<option selected="selected" value="de-DE">German \(Germany\)<\/option><option value=\"en-GB\">English \(United Kingdom\)<\/option><option value="" disabled="disabled">----------<\/option>/
|
55
|
-
end
|
35
|
+
match = /<option selected="selected" value="de-DE">German \(Germany\)<\/option><option value=\"en-GB\">English \(United Kingdom\)<\/option><option value="" disabled="disabled">----------<\/option>/
|
56
36
|
assert_match match, locale_options_for_select('de-DE', 'de-DE', 'en-GB').gsub(/\n/, '')
|
57
37
|
end
|
58
38
|
|
59
39
|
test "should return locale_select" do
|
60
40
|
I18n.locale = :en
|
61
|
-
|
62
|
-
|
63
|
-
match = /<select id="account_locale" name="account\[locale\]"><option value="de-DE" selected="selected">German \(Germany\)<\/option><option value="" disabled="disabled">----------<\/option>/
|
64
|
-
else
|
65
|
-
match = /<select name="account\[locale\]" id="account_locale"><option selected="selected" value="de-DE">German \(Germany\)<\/option><option value="" disabled="disabled">----------<\/option>/
|
66
|
-
end
|
67
|
-
assert_match match, locale_select(@account, :locale, 'de-DE').gsub(/\n/, '')
|
41
|
+
match = /<select name="account\[locale\]" id="account_locale"><option selected="selected" value="de-DE">German \(Germany\)<\/option><option value="" disabled="disabled">----------<\/option>/
|
42
|
+
assert_match match, locale_select(@account, :locale, 'de-DE', {selected: 'de-DE'}).gsub(/\n/, '')
|
68
43
|
end
|
69
44
|
end
|
data/test/state_test.rb
CHANGED
@@ -14,35 +14,26 @@ class StateTest < ActiveSupport::TestCase
|
|
14
14
|
|
15
15
|
test "should return states of Germany in German" do
|
16
16
|
I18n.locale = :de
|
17
|
-
|
18
|
-
if ActiveSupport::VERSION::STRING < '4.0'
|
19
|
-
match = /<option value="BY" selected="selected">Bayern<\/option>/
|
20
|
-
else
|
21
|
-
match = /<option selected="selected" value="BY">Bayern<\/option>/
|
22
|
-
end
|
17
|
+
match = /<option selected="selected" value="BY">Bayern<\/option>/
|
23
18
|
assert_match match, state_options_for_select('DE', 'BY').gsub(/\n/, '')
|
24
19
|
end
|
25
20
|
|
21
|
+
test "should return states of Germany with BE selected" do
|
22
|
+
I18n.locale = :de
|
23
|
+
match = /<option selected="selected" value="BE">Berlin<\/option>/
|
24
|
+
assert_match match, state_options_for_select('DE', 'BE').gsub(/\n/, '')
|
25
|
+
end
|
26
|
+
|
26
27
|
test "should return states of Germany in English" do
|
27
28
|
I18n.locale = :en
|
28
|
-
|
29
|
-
match = /<option value="BY" selected="selected">Bavaria<\/option>/
|
30
|
-
else
|
31
|
-
match = /<option selected="selected" value="BY">Bavaria<\/option>/
|
32
|
-
end
|
29
|
+
match = /<option selected="selected" value="BY">Bavaria<\/option>/
|
33
30
|
assert_match match, state_options_for_select('DE', 'BY').gsub(/\n/, '')
|
34
31
|
end
|
35
32
|
|
36
33
|
test "should return state_select in English" do
|
37
34
|
I18n.locale = :en
|
38
|
-
assert_not_nil results = state_select(@account, :state, 'DE').gsub(/\n/, '')
|
39
|
-
|
40
|
-
|
41
|
-
assert_match(/<select id="account_state" name="account\[state\]">/, results)
|
42
|
-
assert_match(/<option value="BY" selected="selected">Bavaria<\/option>/, results)
|
43
|
-
else
|
44
|
-
assert_match(/<select name="account\[state\]" id="account_state">/, results)
|
45
|
-
assert_match(/<option selected="selected" value="BY">Bavaria<\/option>/, results)
|
46
|
-
end
|
35
|
+
assert_not_nil results = state_select(@account, :state, 'DE', {selected: 'BY'}).gsub(/\n/, '')
|
36
|
+
assert_match(/<select name="account\[state\]" id="account_state">/, results)
|
37
|
+
assert_match(/<option selected="selected" value="BY">Bavaria<\/option>/, results)
|
47
38
|
end
|
48
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i18n_plus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oliver Eilhard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -16,54 +16,54 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 5.2.2.1
|
34
34
|
- - "<"
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: '
|
36
|
+
version: '6'
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
43
|
+
version: 5.2.2.1
|
44
44
|
- - "<"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
46
|
+
version: '6'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: actionpack
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
53
|
+
version: 5.2.2.1
|
54
54
|
- - "<"
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: '
|
56
|
+
version: '6'
|
57
57
|
type: :runtime
|
58
58
|
prerelease: false
|
59
59
|
version_requirements: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
61
|
- - ">="
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version:
|
63
|
+
version: 5.2.2.1
|
64
64
|
- - "<"
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version: '
|
66
|
+
version: '6'
|
67
67
|
- !ruby/object:Gem::Dependency
|
68
68
|
name: bundler
|
69
69
|
requirement: !ruby/object:Gem::Requirement
|
@@ -170,8 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
170
|
- !ruby/object:Gem::Version
|
171
171
|
version: '0'
|
172
172
|
requirements: []
|
173
|
-
|
174
|
-
rubygems_version: 2.7.6
|
173
|
+
rubygems_version: 3.0.1
|
175
174
|
signing_key:
|
176
175
|
specification_version: 4
|
177
176
|
summary: Internally used for working with countries, currencies, and locales. Only
|