Skip to content
This repository was archived by the owner on Mar 16, 2021. It is now read-only.

Commit 394e988

Browse files
committed
Fixes #9456 - Validate docker registry URL
1 parent 9f0918f commit 394e988

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

app/models/docker_registry.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class DockerRegistry < ActiveRecord::Base
88

99
validates_lengths_from_database
1010
validates :name, :presence => true, :uniqueness => true
11+
validates :url, :presence => true, :uniqueness => true
1112

1213
scoped_search :on => :name, :complete_value => true
1314
scoped_search :on => :url

test/units/docker_registry_test.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ class DockerRegistryTest < ActiveSupport::TestCase
2222
assert registry.is_decryptable?(registry.password_in_db)
2323
end
2424

25-
test 'registries need a name' do
26-
registry = FactoryGirl.build(:docker_registry, :name => '')
27-
refute registry.valid?
25+
%w(name url).each do |property|
26+
test "registries need a #{property}" do
27+
refute FactoryGirl.build(:docker_registry, property.to_sym => '').valid?
28+
end
2829
end
2930
end

0 commit comments

Comments
 (0)