diff options
author | Zeger-Jan van de Weg <mail@zjvandeweg.nl> | 2016-02-02 10:44:30 +0100 |
---|---|---|
committer | Zeger-Jan van de Weg <mail@zjvandeweg.nl> | 2016-02-08 12:45:32 +0100 |
commit | 308c967d0dee4b56613d4b285fbd0cf0a1c3ce69 (patch) | |
tree | c91a37f7c7903b278f2a66c60c83ace7d59ffeef /spec | |
parent | 05519b554a49057f6551595a3bc3f01e140f3c0b (diff) | |
download | gitlab-ce-308c967d0dee4b56613d4b285fbd0cf0a1c3ce69.tar.gz |
Validate uniqueness of milestone title per project
Fixes #3903
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/milestone_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/models/milestone_spec.rb b/spec/models/milestone_spec.rb index 30a71987d86..1b1380ce4e2 100644 --- a/spec/models/milestone_spec.rb +++ b/spec/models/milestone_spec.rb @@ -33,6 +33,20 @@ describe Milestone, models: true do let(:milestone) { create(:milestone) } let(:issue) { create(:issue) } + describe "unique milestone title per project" do + it "shouldn't accept the same title in a project twice" do + new_milestone = Milestone.new(project: milestone.project, title: milestone.title) + expect(new_milestone).not_to be_valid + end + + it "should accept the same title in another project" do + project = build(:project) + new_milestone = Milestone.new(project: project, title: milestone.title) + + expect(new_milestone).to be_valid + end + end + describe "#percent_complete" do it "should not count open issues" do milestone.issues << issue |