diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-16 15:06:26 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-16 15:06:26 +0000 |
commit | 84727c8209a4412e21111a07f99b0438b03232de (patch) | |
tree | 1fcfa02b01548c3cdc561186870a1c807f227f0b /spec/models/release_spec.rb | |
parent | d2798d607e11e0ebae83ae909404834388733428 (diff) | |
download | gitlab-ce-84727c8209a4412e21111a07f99b0438b03232de.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/release_spec.rb')
-rw-r--r-- | spec/models/release_spec.rb | 13 |
1 files changed, 7 insertions, 6 deletions
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 |