test/unit/localization_test.rb in stringex-2.6.1 vs test/unit/localization_test.rb in stringex-2.7.0
- old
+ new
@@ -9,11 +9,11 @@
end
def test_stores_translations
Stringex::Localization.backend = :internal
- data = { :one => "number one", :two => "number two" }
+ data = { one: "number one", two: "number two" }
Stringex::Localization.store_translations :en, :test_store, data
data.each do |key, value|
assert_equal value, Stringex::Localization.translate(:test_store, key)
end
@@ -32,32 +32,32 @@
end
def test_can_translate
Stringex::Localization.backend = :internal
- data = { :one => "number one", :two => "number two" }
+ data = { one: "number one", two: "number two" }
Stringex::Localization.store_translations :en, :test_translate, data
data.each do |key, value|
assert_equal value, Stringex::Localization.translate(:test_translate, key)
end
end
def test_can_translate_when_given_string_as_key
Stringex::Localization.backend = :internal
- data = { :one => "number one", :two => "number two" }
+ data = { one: "number one", two: "number two" }
Stringex::Localization.store_translations :en, :test_translate, data
data.each do |key, value|
assert_equal value, Stringex::Localization.translate(:test_translate, key.to_s)
end
end
def test_returns_default_if_none_found
Stringex::Localization.backend = :internal
- assert_equal "my default", Stringex::Localization.translate(:test_default, :nonexistent, :default => "my default")
+ assert_equal "my default", Stringex::Localization.translate(:test_default, :nonexistent, default: "my default")
end
def test_returns_nil_if_no_default
Stringex::Localization.backend = :internal
assert_nil Stringex::Localization.translate(:test_no_default, :nonexistent)
@@ -89,24 +89,24 @@
end
def test_stores_translations_in_i18n
Stringex::Localization.backend = :i18n
- data = { :one => "number one", :two => "number two" }
+ data = { one: "number one", two: "number two" }
Stringex::Localization.store_translations :en, :test_i18n_store, data
data.each do |key, value|
assert_equal value, I18n.translate("stringex.test_i18n_store.#{key}")
end
end
def test_can_translate_using_i18n
Stringex::Localization.backend = :i18n
- data = { :one => "number one", :two => "number two" }
+ data = { one: "number one", two: "number two" }
- I18n.backend.store_translations :en, { :stringex => { :test_i18n_translation => data } }
+ I18n.backend.store_translations :en, { stringex: { test_i18n_translation: data } }
data.each do |key, value|
assert_equal value, Stringex::Localization.translate(:test_i18n_translation, key)
end
end
@@ -115,10 +115,10 @@
[:internal, :i18n].each do |backend|
Stringex::Localization.backend = backend
assert_equal "Test blank", "Test blank".convert_miscellaneous_html_entities
- Stringex::Localization.store_translations :en, :html_entities, { :nbsp => "" }
+ Stringex::Localization.store_translations :en, :html_entities, { nbsp: "" }
assert_equal "Testblank", "Test blank".convert_miscellaneous_html_entities
end
end
def test_assigns_locale_in_i18n_backend