Skip to content

Commit

Permalink
MiqServer#description - most models have desc
Browse files Browse the repository at this point in the history
If the server name is nil, then code sometimes blows up
This defines the description on miq server so it acts like most
of our other models displayed in the ui
  • Loading branch information
kbrock committed Jul 3, 2018
1 parent 421074d commit 545e771
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/models/miq_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class MiqServer < ApplicationRecord
acts_as_miq_taggable
include RelationshipMixin

alias_attribute :description, :name

belongs_to :vm, :inverse_of => :miq_server
belongs_to :zone
has_many :messages, :as => :handler, :class_name => 'MiqQueue'
Expand Down
7 changes: 7 additions & 0 deletions spec/models/miq_server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -456,4 +456,11 @@
expect(miq_server.zone_description).to eq(zone.description)
end
end

describe "#description" do
it "doesnt blowup" do
s = described_class.new(:name => "name")
expect(s.description).to eq(s.name)
end
end
end

0 comments on commit 545e771

Please sign in to comment.