diff options
| author | Robert Schilling <rschilling@student.tugraz.at> | 2014-08-11 23:59:30 +0200 |
|---|---|---|
| committer | Robert Schilling <rschilling@student.tugraz.at> | 2014-08-13 15:48:26 +0200 |
| commit | a3c969cd92a2f658d322bec1cfe07c520b678bf7 (patch) | |
| tree | b06cef7d6227c5e3b9129f9c80a50968ff0f28bb /app | |
| parent | 6085b6a765f4db9c167fb607af5f605f0d9b586d (diff) | |
| download | gitlab-ce-a3c969cd92a2f658d322bec1cfe07c520b678bf7.tar.gz | |
Add testcase for invalid color
Diffstat (limited to 'app')
| -rw-r--r-- | app/models/label.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/models/label.rb b/app/models/label.rb index ce982579675..e2379bb6d77 100644 --- a/app/models/label.rb +++ b/app/models/label.rb @@ -3,10 +3,12 @@ class Label < ActiveRecord::Base has_many :label_links, dependent: :destroy has_many :issues, through: :label_links, source: :target, source_type: 'Issue' - validates :color, format: { with: /\A\#[0-9A-Fa-f]{6}+\Z/ }, allow_blank: true + validates :color, + format: { with: /\A\#[0-9A-Fa-f]{6}+\Z/ }, + allow_blank: false validates :project, presence: true - # Dont allow '?', '&', and ',' for label titles + # Don't allow '?', '&', and ',' for label titles validates :title, presence: true, format: { with: /\A[^&\?,&]*\z/ } scope :order_by_name, -> { reorder("labels.title ASC") } |
