Skip to content

Commit

Permalink
Merge pull request #20361 from jrafanie/translate_compare_section_hea…
Browse files Browse the repository at this point in the history
…ders_for_all_models

Ensure remaining models are translated but not through rails' titleize
  • Loading branch information
h-kataria authored Jul 16, 2020
2 parents d94456d + ca162ce commit d6ea037
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/miq_compare.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def section_header_text(model)
when "VmOrTemplate"
_("Workload")
else
model.titleize
ui_lookup(:model => model)
end
end

Expand Down
24 changes: 24 additions & 0 deletions spec/models/miq_compare_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit d6ea037

Please sign in to comment.