Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display name instead of [object Object] for the Host in Network Port's Relationships table #6403

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
16 changes: 16 additions & 0 deletions spec/helpers/network_port_helper/textual_summary_spec.rb
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