summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorSamantaz Fox <coding@samantaz.fr>2022-01-11 18:27:56 +0100
committerSamantaz Fox <coding@samantaz.fr>2022-01-12 00:49:36 +0100
commit0120f44fd664826ed47a84959a196931e84540d7 (patch)
tree61a71935b139047214887cb898b6719bf0439ee0 /spec
parent1f2ccac8a0b529a045a40076ad24fa859dd15289 (diff)
downloadinvidious-0120f44fd664826ed47a84959a196931e84540d7.tar.gz
invidious-0120f44fd664826ed47a84959a196931e84540d7.tar.bz2
invidious-0120f44fd664826ed47a84959a196931e84540d7.zip
i18n: use spectator for i18next plurals spec
Diffstat (limited to 'spec')
-rw-r--r--spec/i18next_plurals_spec.cr24
1 files changed, 15 insertions, 9 deletions
diff --git a/spec/i18next_plurals_spec.cr b/spec/i18next_plurals_spec.cr
index ec14f418..ee9ff394 100644
--- a/spec/i18next_plurals_spec.cr
+++ b/spec/i18next_plurals_spec.cr
@@ -1,7 +1,14 @@
-require "spec"
+require "spectator"
require "../src/invidious/helpers/i18next.cr"
-resolver = I18next::Plurals::RESOLVER
+Spectator.configure do |config|
+ config.fail_blank
+ config.randomize
+end
+
+def resolver
+ I18next::Plurals::RESOLVER
+end
FORM_TESTS = {
"ach" => I18next::Plurals::PluralForms::Single_gt_one,
@@ -30,7 +37,6 @@ FORM_TESTS = {
"su" => I18next::Plurals::PluralForms::None,
"sk" => I18next::Plurals::PluralForms::Special_Czech_Slovak,
"sl" => I18next::Plurals::PluralForms::Special_Slovenian,
-
}
SUFFIX_TESTS = {
@@ -187,20 +193,20 @@ SUFFIX_TESTS = {
],
}
-describe "i18next_Plural_Resolver" do
+Spectator.describe "i18next_Plural_Resolver" do
describe "get_plural_form" do
- FORM_TESTS.each do |locale, form|
+ sample FORM_TESTS do |locale, form|
it "returns the right plural form for locale '#{locale}'" do
- resolver.get_plural_form(locale).should eq(form)
+ expect(resolver.get_plural_form(locale)).to eq(form)
end
end
end
describe "get_suffix" do
- SUFFIX_TESTS.each do |locale, data|
+ sample SUFFIX_TESTS do |locale, tests|
it "returns the right suffix for locale '#{locale}'" do
- data.each do |d|
- resolver.get_suffix(locale, d[:num]).should eq(d[:suffix])
+ tests.each do |d|
+ expect(resolver.get_suffix(locale, d[:num])).to eq(d[:suffix])
end
end
end