Project

General

Profile

Revision ab3290b1

Added by Swapnil Abnave over 4 years ago

Fixes #20429 - mandate URL for docker compute-resource

View differences:

app/models/foreman_docker/docker.rb
2 2

  
3 3
module ForemanDocker
4 4
  class Docker < ::ComputeResource
5
    validates :url, :format => { :with => URI.regexp }
5
    validates :url, :format => { :with => URI.regexp }, :presence => true
6 6
    validates :email, :format => { :with => /.+@.+\..+/i }, :allow_blank => true
7 7

  
8 8
    def self.model_name
test/units/foreman_docker/docker_test.rb
2 2

  
3 3
module ForemanDocker
4 4
  class DockerTest < ActiveSupport::TestCase
5
    should validate_presence_of(:url)
5 6
    should allow_value('a@b.com').for(:email)
6 7
    should allow_value('').for(:email)
7 8
    should_not allow_value('abcb.com').for(:email)

Also available in: Unified diff