From b00b9381014276ab0b5356a0b71197a430dd4a4d Mon Sep 17 00:00:00 2001 From: Richard Towers Date: Tue, 5 Nov 2024 10:12:01 +0000 Subject: [PATCH] Fix image kind names I accidentally broke these refactoring a .map() to a .transform_values() even though I was using the key. Before this change .name() was the class name (Whitehall::ImageKinds), not the name of the image kind. --- lib/whitehall/image_kinds.rb | 2 +- test/unit/lib/whitehall_test.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/whitehall/image_kinds.rb b/lib/whitehall/image_kinds.rb index 8c43343bf5d..d4999bb34a7 100644 --- a/lib/whitehall/image_kinds.rb +++ b/lib/whitehall/image_kinds.rb @@ -39,7 +39,7 @@ def version_names class ImageKinds def self.build_image_kinds(hash) - hash.transform_values { |config| ImageKind.new(name, config) }.freeze + hash.to_h { |name, config| [name, ImageKind.new(name, config)] }.freeze end end end diff --git a/test/unit/lib/whitehall_test.rb b/test/unit/lib/whitehall_test.rb index af61cfec7ef..23e337c2446 100644 --- a/test/unit/lib/whitehall_test.rb +++ b/test/unit/lib/whitehall_test.rb @@ -27,6 +27,7 @@ class WhitehallTest < ActiveSupport::TestCase test "Whitehall.image_kinds is populated with defaults from config" do assert_pattern do Whitehall.image_kinds["default"] => { + name: "default", valid_width: 960, valid_height: 640, versions: [