Skip to content

Commit

Permalink
Fix error messages for requests
Browse files Browse the repository at this point in the history
  • Loading branch information
bdaase committed Mar 4, 2019
1 parent 0eec8dd commit 6f66667
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/models/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class Request < ApplicationRecord
end

def name_uniqueness
errors.add('vSphere already has a VM with the same name') if VSphere::VirtualMachine.all.map(&:name).include?(name)
errors.add('There is already a request with the same name') if (Request.pending + Request.accepted).map(&:name).include?(name)
errors.add(:name, ': vSphere already has a VM with the same name') if VSphere::VirtualMachine.all.map(&:name).include?(name)
errors.add(:name, ': There is already a request with the same name') if (Request.pending + Request.accepted).map(&:name).include?(name)
end

def description_text(host_name)
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/requests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

FactoryBot.define do
factory :request do
name { 'myvm' }
name { Faker::Alphanumeric.unique.alphanumeric 10 }
cpu_cores { 2 }
ram_gb { 1 }
storage_gb { 3 }
Expand Down

0 comments on commit 6f66667

Please sign in to comment.