Skip to content

Commit

Permalink
Display name instead of [object Object] in Network Port's Relationships
Browse files Browse the repository at this point in the history
Issue: #6311
  • Loading branch information
hstastna committed Nov 12, 2019
1 parent 4b8a2b5 commit 51b9a03
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/helpers/network_port_helper/textual_summary.rb
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
14 changes: 14 additions & 0 deletions spec/helpers/network_port_helper/textual_summary_spec.rb
Expand Up @@ -11,4 +11,18 @@
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)
end

it 'returns device name of the record' do
expect(textual_host[:value]).to eq(host.name)
end
end
end

0 comments on commit 51b9a03

Please sign in to comment.