diff --git a/app/helpers/network_port_helper/textual_summary.rb b/app/helpers/network_port_helper/textual_summary.rb index b6010ffa00a..b8997ac5b44 100644 --- a/app/helpers/network_port_helper/textual_summary.rb +++ b/app/helpers/network_port_helper/textual_summary.rb @@ -86,7 +86,7 @@ def textual_host return nil unless @record.device_type == "Host" { :icon => "pficon pficon-container-node", - :value => @record.device, + :value => @record.device.name, :link => url_for_only_path( :controller => "host", :action => "show", diff --git a/spec/helpers/network_port_helper/textual_summary_spec.rb b/spec/helpers/network_port_helper/textual_summary_spec.rb index 69e56126dff..fef79fdbd0b 100644 --- a/spec/helpers/network_port_helper/textual_summary_spec.rb +++ b/spec/helpers/network_port_helper/textual_summary_spec.rb @@ -11,4 +11,20 @@ security_groups host ) + + describe '#textual_host' do + let(:host) { FactoryBot.create(:host) } + let(:port) { FactoryBot.create(:network_port, :device_type => 'Host', :device => host) } + + before do + instance_variable_set(:@record, port) + allow(self).to receive(:url_for_only_path).and_return("/host/show/#{host.id}") + end + + it 'returns Host of selected Network Port' do + expect(textual_host[:icon]).to eq('pficon pficon-container-node') + expect(textual_host[:value]).to eq(host.name) + expect(textual_host[:link]).to eq("/host/show/#{host.id}") + end + end end