Commit 99c21603 authored by Jan Provaznik's avatar Jan Provaznik

Drop uniqueness validation of project_key

It's not necessary to enforce this validation because also project
full path is part of the email key.
parent ad9e7c76
......@@ -8,7 +8,6 @@ class ServiceDeskSetting < ApplicationRecord
validate :valid_issue_template
validates :outgoing_name, length: { maximum: 255 }, allow_blank: true
validates :project_key, length: { maximum: 255 }, allow_blank: true, format: { with: /\A[a-z0-9_]+\z/ }
validates_uniqueness_of :project_key, allow_nil: true
def issue_template_content
strong_memoize(:issue_template_content) do
......
......@@ -9,7 +9,6 @@ describe ServiceDeskSetting do
it { is_expected.to validate_presence_of(:project_id) }
it { is_expected.to validate_length_of(:outgoing_name).is_at_most(255) }
it { is_expected.to validate_length_of(:project_key).is_at_most(255) }
it { is_expected.to validate_uniqueness_of(:project_key).allow_nil }
it { is_expected.to allow_value('abc123_').for(:project_key) }
it { is_expected.not_to allow_value('abc 12').for(:project_key) }
it { is_expected.not_to allow_value('Big val').for(:project_key) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment