From eaba732e91e9b0d37d47e2cccacb1960daf95145 Mon Sep 17 00:00:00 2001 From: Walmyr Lima Date: Fri, 26 Apr 2019 18:33:41 +0200 Subject: [PATCH] Refactor quarantine helper By moving methods closer to where they are called. --- qa/qa/specs/helpers/quarantine.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/qa/qa/specs/helpers/quarantine.rb b/qa/qa/specs/helpers/quarantine.rb index 52cb05fcd13..ca0ce32e74f 100644 --- a/qa/qa/specs/helpers/quarantine.rb +++ b/qa/qa/specs/helpers/quarantine.rb @@ -20,6 +20,14 @@ module QA::Specs::Helpers end end + # Skip the entire context if a context is quarantined. This avoids running + # before blocks unnecessarily. + def skip_or_run_quarantined_contexts(filters, example) + return unless example.metadata.key?(:quarantine) + + skip_or_run_quarantined_tests_or_contexts(filters, example) + end + # Skip tests in quarantine unless we explicitly focus on them. def skip_or_run_quarantined_tests_or_contexts(filters, example) if filters.key?(:quarantine) @@ -39,14 +47,6 @@ module QA::Specs::Helpers end end - # Skip the entire context if a context is quarantined. This avoids running - # before blocks unnecessarily. - def skip_or_run_quarantined_contexts(filters, example) - return unless example.metadata.key?(:quarantine) - - skip_or_run_quarantined_tests_or_contexts(filters, example) - end - def filters_other_than_quarantine(filter) filter.reject { |key, _| key == :quarantine } end