Skip to content

Commit

Permalink
Update the EMS validation for hostname so that uniqueness is not scop…
Browse files Browse the repository at this point in the history
  • Loading branch information
lfu committed Nov 18, 2015
1 parent 8069e78 commit 83e2f17
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/models/ext_management_system.rb
Expand Up @@ -55,7 +55,7 @@ def self.supported_types_and_descriptions_hash
validates :name, :presence => true, :uniqueness => {:scope => [:tenant_id]}
validates :hostname,
:presence => true,
:uniqueness => {:scope => [:tenant_id], :case_sensitive => false},
:uniqueness => {:case_sensitive => false},
:if => :hostname_required?

# TODO: Remove all callers of address
Expand Down
4 changes: 2 additions & 2 deletions spec/models/ext_management_system_spec.rb
Expand Up @@ -193,10 +193,10 @@
end.to_not raise_error
end

it "allowing duplicate hostname" do
it "not allowing duplicate hostname" do
expect do
FactoryGirl.create(:ems_vmware, :hostname => @ems.hostname, :tenant => @tenant2)
end.to_not raise_error
end.to raise_error(ActiveRecord::RecordInvalid)
end
end
end
Expand Down

0 comments on commit 83e2f17

Please sign in to comment.