From e5f5f27b648d3bdc7a21753ef90a7b85ae94299b Mon Sep 17 00:00:00 2001 From: Nicholas La Roux Date: Sun, 8 Jun 2025 18:29:41 +0900 Subject: [PATCH] Fix example_city and example_city_zip tests so they actually assert The tests currently appear to not be testing anything as assert_predicate does not appear to accept a block. As such the following warning appears when running the tests: ```console /home/larouxn/src/github.com/larouxn/worldwide/test/worldwide/region_yml_consistency_test.rb:488: warning: the block passed to 'assert_predicate' defined at /home/larouxn/.gem/ruby/3.4.4/gems/minitest-5.25.5/lib/minitest/assertions.rb:391 may be ignored ``` --- test/worldwide/region_yml_consistency_test.rb | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/test/worldwide/region_yml_consistency_test.rb b/test/worldwide/region_yml_consistency_test.rb index 3cac2e546..638a91b12 100644 --- a/test/worldwide/region_yml_consistency_test.rb +++ b/test/worldwide/region_yml_consistency_test.rb @@ -485,14 +485,22 @@ class RegionYmlConsistencyTest < ActiveSupport::TestCase end test "example_city is available for each US state" do - assert_predicate Worldwide.region(code: "US").zones, :all? do |state| - !state.example_city&.empty? + Worldwide.region(code: "US").zones.each do |state| + # Skip territories that legitimately don't have cities + next if state.iso_code == "UM" # United States Minor Outlying Islands + + assert_kind_of String, state.example_city, "example_city should be a String for #{state.iso_code}" + refute_predicate state.example_city, :empty?, "example_city should not be empty for #{state.iso_code}" end end test "example_city_zip is available for each US state" do - assert_predicate Worldwide.region(code: "US").zones, :all? do |state| - !state.example_city_zip&.empty? + Worldwide.region(code: "US").zones.each do |state| + # Skip territories that legitimately don't have zip codes + next if state.iso_code == "UM" # United States Minor Outlying Islands + + assert_kind_of String, state.example_city_zip, "example_city_zip should be a String for #{state.iso_code}" + refute_predicate state.example_city_zip, :empty?, "example_city_zip should not be empty for #{state.iso_code}" end end