From 459748035d53d46306f18fb103173a313f1a8b45 Mon Sep 17 00:00:00 2001 From: Oscar Wyatt Date: Wed, 15 Aug 2018 15:03:54 +0100 Subject: [PATCH 1/3] Fix intermittent failing test --- test/integration/links_out_config_test.rb | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/test/integration/links_out_config_test.rb b/test/integration/links_out_config_test.rb index af690aea7..0a94391dc 100644 --- a/test/integration/links_out_config_test.rb +++ b/test/integration/links_out_config_test.rb @@ -51,14 +51,16 @@ def assert_has_supergroup_navigation(expected_supergroups) test "links out configuration causes no errors and correct supergroups are displayed for each ruleset" do stub_rummager setup_variant_b - config.each_key do |taxonomy_rule_level| - config[taxonomy_rule_level].each_key do |rules_for_taxon| - setup_and_visit_content_item_with_taxonomy_grouping("guide", taxonomy_rule_level => rules_for_taxon) - expected_supergroups = expected_supergroups(config[taxonomy_rule_level][rules_for_taxon]) - if expected_supergroups.any? - assert_has_supergroup_navigation(expected_supergroups) - else - refute page.has_css?('taxonomy-navigation') + using_wait_time 10 do + config.each_key do |taxonomy_rule_level| + config[taxonomy_rule_level].each_key do |rules_for_taxon| + setup_and_visit_content_item_with_taxonomy_grouping("guide", taxonomy_rule_level => rules_for_taxon) + expected_supergroups = expected_supergroups(config[taxonomy_rule_level][rules_for_taxon]) + if expected_supergroups.any? + assert_has_supergroup_navigation(expected_supergroups) + else + refute page.has_css?('taxonomy-navigation') + end end end end From 77ced320dcd5ffd8f21b35eea062c0d659626b24 Mon Sep 17 00:00:00 2001 From: Oscar Wyatt Date: Wed, 15 Aug 2018 15:50:28 +0100 Subject: [PATCH 2/3] Fixed rails config occasionally returning nil --- test/integration/links_out_config_test.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/integration/links_out_config_test.rb b/test/integration/links_out_config_test.rb index 0a94391dc..dfe3d68bc 100644 --- a/test/integration/links_out_config_test.rb +++ b/test/integration/links_out_config_test.rb @@ -32,8 +32,8 @@ def default_taxonomy_grouping } end - def config - Rails.configuration.taxonomy_navigation_links_out + def taxon_config + Rails.configuration.taxonomy_navigation_links_out || YAML.load(File.read("config/taxonomy_navigation_links_out.yml"))["default"] end def expected_supergroups(rule_level) @@ -52,10 +52,10 @@ def assert_has_supergroup_navigation(expected_supergroups) stub_rummager setup_variant_b using_wait_time 10 do - config.each_key do |taxonomy_rule_level| - config[taxonomy_rule_level].each_key do |rules_for_taxon| + taxon_config.each_key do |taxonomy_rule_level| + taxon_config[taxonomy_rule_level].each_key do |rules_for_taxon| setup_and_visit_content_item_with_taxonomy_grouping("guide", taxonomy_rule_level => rules_for_taxon) - expected_supergroups = expected_supergroups(config[taxonomy_rule_level][rules_for_taxon]) + expected_supergroups = expected_supergroups(taxon_config[taxonomy_rule_level][rules_for_taxon]) if expected_supergroups.any? assert_has_supergroup_navigation(expected_supergroups) else From 372c786aa932a29d8a23c29117137ede0bdb9d0e Mon Sep 17 00:00:00 2001 From: Oscar Wyatt Date: Wed, 15 Aug 2018 15:53:10 +0100 Subject: [PATCH 3/3] Appease linter --- test/integration/links_out_config_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/links_out_config_test.rb b/test/integration/links_out_config_test.rb index dfe3d68bc..c25fb86c1 100644 --- a/test/integration/links_out_config_test.rb +++ b/test/integration/links_out_config_test.rb @@ -33,7 +33,7 @@ def default_taxonomy_grouping end def taxon_config - Rails.configuration.taxonomy_navigation_links_out || YAML.load(File.read("config/taxonomy_navigation_links_out.yml"))["default"] + Rails.configuration.taxonomy_navigation_links_out || YAML.safe_load(File.read("config/taxonomy_navigation_links_out.yml"))["default"] end def expected_supergroups(rule_level)