From 84727c8209a4412e21111a07f99b0438b03232de Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Mon, 16 Sep 2019 15:06:26 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- spec/models/release_spec.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'spec/models/release_spec.rb') diff --git a/spec/models/release_spec.rb b/spec/models/release_spec.rb index c690390e24d..8714c67f29d 100644 --- a/spec/models/release_spec.rb +++ b/spec/models/release_spec.rb @@ -13,7 +13,8 @@ RSpec.describe Release do it { is_expected.to belong_to(:project) } it { is_expected.to belong_to(:author).class_name('User') } it { is_expected.to have_many(:links).class_name('Releases::Link') } - it { is_expected.to have_one(:milestone) } + it { is_expected.to have_many(:milestones) } + it { is_expected.to have_many(:milestone_releases) } end describe 'validation' do @@ -38,15 +39,15 @@ RSpec.describe Release do context 'when a release is tied to a milestone for another project' do it 'creates a validation error' do - release.milestone = build(:milestone, project: create(:project)) - expect(release).not_to be_valid + milestone = build(:milestone, project: create(:project)) + expect { release.milestones << milestone }.to raise_error end end context 'when a release is tied to a milestone linked to the same project' do - it 'is valid' do - release.milestone = build(:milestone, project: project) - expect(release).to be_valid + it 'successfully links this release to this milestone' do + milestone = build(:milestone, project: project) + expect { release.milestones << milestone }.to change { MilestoneRelease.count }.by(1) end end end -- cgit v1.2.1