diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-05-04 11:17:16 +0200 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-05-29 15:03:00 -0400 |
commit | fc57d36018a23c15da013bebf42d51f7a8e9a955 (patch) | |
tree | 8b0b5331eaf4a4925e68562418b7027bfd64eff0 /spec/models/note_spec.rb | |
parent | 99ef3a84b558e7b51bce7cbb11a6e235a6cc310b (diff) | |
download | gitlab-ce-fc57d36018a23c15da013bebf42d51f7a8e9a955.tar.gz |
Minor changes in note validation specs
Diffstat (limited to 'spec/models/note_spec.rb')
-rw-r--r-- | spec/models/note_spec.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb index 20d40c47aa6..e1b81b23d4b 100644 --- a/spec/models/note_spec.rb +++ b/spec/models/note_spec.rb @@ -13,29 +13,30 @@ describe Note, models: true do it { is_expected.to validate_presence_of(:note) } it { is_expected.to validate_presence_of(:project) } - context 'when note is comment on commit' do + context 'when note is on commit' do before { allow(subject).to receive(:for_commit?).and_return(true) } it { is_expected.to validate_presence_of(:commit_id) } it { is_expected.to_not validate_presence_of(:noteable_id) } end - context 'when note is not comment on commit' do + context 'when note is not on commit' do before { allow(subject).to receive(:for_commit?).and_return(false) } it { is_expected.to_not validate_presence_of(:commit_id) } it { is_expected.to validate_presence_of(:noteable_id) } end - context 'when noteable and note project is different' do + context 'when noteable and note project differ' do subject do - build(:note, noteable: create(:issue), project: create(:project)) + build(:note, noteable: build_stubbed(:issue), + project: build_stubbed(:project)) end it { is_expected.to be_invalid } end - context 'when noteable and note project is the same one' do + context 'when noteable and note project are the same' do subject { create(:note) } it { is_expected.to be_valid } end |