Skip to content

Commit

Permalink
Merge pull request #6403 from hstastna/Host_name_Relationships_Networ…
Browse files Browse the repository at this point in the history
…k_Port

Display name instead of [object Object] for the Host in Network Port's Relationships table
  • Loading branch information
mzazrivec authored Nov 13, 2019
2 parents c521654 + f541c6d commit 455c8a8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/helpers/network_port_helper/textual_summary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
16 changes: 16 additions & 0 deletions spec/helpers/network_port_helper/textual_summary_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 455c8a8

Please sign in to comment.