Files
grecia/spec/support/common_actions/translations.rb
Javi Martín 44d137a4c0 Simplify translatable tests in admin section
These feature tests were taking too long, we can't run them for every
single model.

I'm taking the approach of using one different model for each test, but
in theory only using a few models covering every possible scenario
would be enough.
2019-09-23 18:01:44 +02:00

23 lines
527 B
Ruby

module Translations
def text_for(field, locale)
I18n.with_locale(locale) do
"#{translatable.class.human_attribute_name(field)} #{language_texts[locale]}"
end
end
def expect_not_to_have_language(language)
expect(page).not_to have_select :select_language, with_options: [language]
end
def expect_to_have_language_selected(language)
expect(page).to have_select :select_language, selected: language
end
def language_texts
{
es: "en español",
en: "in English"
}
end
end