Use if instead of skip to skip tests
This way the tests won't appear as "pending" when running the test suite, and so we get rid of a lot of noise in the test results. There doesn't seem to be a way to call `skip` without the test being marked as "pending". Note that in the globalizable tests we need to build a factory before deciding whether an atribute is required or not (particularly for the milestone factory, since milestone attributes are required depending on the presence of other attributes). This isn't possible before we're inside the test, so we can't add an `if:` condition to the test. So we're adding the condition inside the test instead. A minor inconvenience of this method is the test still runs even when the condition is `false`.
This commit is contained in:
@@ -167,11 +167,8 @@ describe "Admin poll questions", :admin do
|
||||
options: ["Seleccionar votación", poll.name_es])
|
||||
end
|
||||
|
||||
scenario "uses fallback if name is not translated to current locale" do
|
||||
unless globalize_french_fallbacks.first == :es
|
||||
skip("Spec only useful when French falls back to Spanish")
|
||||
end
|
||||
|
||||
scenario "uses fallback if name is not translated to current locale",
|
||||
if: Globalize.fallbacks(:fr).reject { |locale| locale.match(/fr/) }.first == :es do
|
||||
poll = create(:poll, name_en: "Name in English", name_es: "Nombre en Español")
|
||||
proposal = create(:proposal)
|
||||
|
||||
@@ -186,8 +183,4 @@ describe "Admin poll questions", :admin do
|
||||
options: ["Sélectionner un vote", poll.name_es])
|
||||
end
|
||||
end
|
||||
|
||||
def globalize_french_fallbacks
|
||||
Globalize.fallbacks(:fr).reject { |locale| locale.match(/fr/) }
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user