summaryrefslogtreecommitdiff
path: root/spec/models/milestone_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-03 18:06:49 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-03 18:06:49 +0000
commitab7cf450ba19cf80b9534f25dc707b33845e3014 (patch)
treebbfa6aba83c48aea68d79c4179ce576b6eec326d /spec/models/milestone_spec.rb
parent4204cf308596e0e26f578a6e2da88f49c0f4aad9 (diff)
downloadgitlab-ce-ab7cf450ba19cf80b9534f25dc707b33845e3014.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/milestone_spec.rb')
-rw-r--r--spec/models/milestone_spec.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/models/milestone_spec.rb b/spec/models/milestone_spec.rb
index 45cd2768708..d84a8665dc8 100644
--- a/spec/models/milestone_spec.rb
+++ b/spec/models/milestone_spec.rb
@@ -106,6 +106,40 @@ describe Milestone do
end
end
+ describe '#merge_requests_enabled?' do
+ context "per project" do
+ it "is true for projects with MRs enabled" do
+ project = create(:project, :merge_requests_enabled)
+ milestone = create(:milestone, project: project)
+
+ expect(milestone.merge_requests_enabled?).to be(true)
+ end
+
+ it "is false for projects with MRs disabled" do
+ project = create(:project, :repository_enabled, :merge_requests_disabled)
+ milestone = create(:milestone, project: project)
+
+ expect(milestone.merge_requests_enabled?).to be(false)
+ end
+
+ it "is false for projects with repository disabled" do
+ project = create(:project, :repository_disabled)
+ milestone = create(:milestone, project: project)
+
+ expect(milestone.merge_requests_enabled?).to be(false)
+ end
+ end
+
+ context "per group" do
+ let(:group) { create(:group) }
+ let(:milestone) { create(:milestone, group: group) }
+
+ it "is always true for groups, for performance reasons" do
+ expect(milestone.merge_requests_enabled?).to be(true)
+ end
+ end
+ end
+
describe "unique milestone title" do
context "per project" do
it "does not accept the same title in a project twice" do