From ca162ceb5d41c3c9bd5d23b18f0ce1d402b3d335 Mon Sep 17 00:00:00 2001 From: Joe Rafaniello Date: Thu, 16 Jul 2020 10:19:23 -0400 Subject: [PATCH] Ensure remaining models are translated but not through rails' titleize Fixes https://github.ibm.com/IBMPrivateCloud/CP4MCM/issues/10405 --- app/models/miq_compare.rb | 2 +- spec/models/miq_compare_spec.rb | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/app/models/miq_compare.rb b/app/models/miq_compare.rb index a2db004f13f..595a3917141 100644 --- a/app/models/miq_compare.rb +++ b/app/models/miq_compare.rb @@ -184,7 +184,7 @@ def section_header_text(model) when "VmOrTemplate" _("Workload") else - model.titleize + ui_lookup(:model => model) end end diff --git a/spec/models/miq_compare_spec.rb b/spec/models/miq_compare_spec.rb index 915cd4afe27..062c518fb44 100644 --- a/spec/models/miq_compare_spec.rb +++ b/spec/models/miq_compare_spec.rb @@ -29,4 +29,28 @@ expect { loaded = Marshal.load(dumped) }.not_to raise_error end end + + context "headers are translated" do + it "for EmsCluster" do + skip "Assumptions based on English message catalog" unless FastGettext.locale == "en" + + obj1 = FactoryBot.create(:ems_cluster) + obj2 = FactoryBot.create(:ems_cluster) + MiqReport.seed_report("clusters") + report = MiqReport.find_by(:title => "Cluster Compare Template") + compare = MiqCompare.new({:ids => [obj1.id, obj2.id]}, report) + expect(compare.master_list[0][:header]).to eq("Cluster") + end + + it "for Host" do + skip "Assumptions based on English message catalog" unless FastGettext.locale == "en" + + obj1 = FactoryBot.create(:host_vmware) + obj2 = FactoryBot.create(:host_vmware) + MiqReport.seed_report("hosts") + report = MiqReport.find_by(:name => "Hosts: Compare Template") + compare = MiqCompare.new({:ids => [obj1.id, obj2.id]}, report) + expect(compare.master_list[0][:header]).to eq("Host Properties") + end + end end