diff options
Diffstat (limited to 'spec/models/concerns')
-rw-r--r-- | spec/models/concerns/mentionable_spec.rb | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/spec/models/concerns/mentionable_spec.rb b/spec/models/concerns/mentionable_spec.rb index 6034344d034..883f678b8f5 100644 --- a/spec/models/concerns/mentionable_spec.rb +++ b/spec/models/concerns/mentionable_spec.rb @@ -166,6 +166,21 @@ describe Issue, "Mentionable" do create(:issue, project: project, description: description, author: author) end end + + describe '#store_mentions!' do + it_behaves_like 'mentions in description', :issue + it_behaves_like 'mentions in notes', :issue do + let(:note) { create(:note_on_issue) } + let(:mentionable) { note.noteable } + end + end + + describe 'load mentions' do + it_behaves_like 'load mentions from DB', :issue do + let(:note) { create(:note_on_issue) } + let(:mentionable) { note.noteable } + end + end end describe Commit, 'Mentionable' do @@ -221,4 +236,56 @@ describe Commit, 'Mentionable' do end end end + + describe '#store_mentions!' do + it_behaves_like 'mentions in notes', :commit do + let(:note) { create(:note_on_commit) } + let(:mentionable) { note.noteable } + end + end + + describe 'load mentions' do + it_behaves_like 'load mentions from DB', :commit do + let(:note) { create(:note_on_commit) } + let(:mentionable) { note.noteable } + end + end +end + +describe MergeRequest, 'Mentionable' do + describe '#store_mentions!' do + it_behaves_like 'mentions in description', :merge_request + it_behaves_like 'mentions in notes', :merge_request do + let(:project) { create(:project) } + let(:merge_request) { create(:merge_request, source_project: project, target_project: project) } + let(:note) { create(:note_on_merge_request, noteable: merge_request, project: merge_request.project) } + let(:mentionable) { note.noteable } + end + end + + describe 'load mentions' do + it_behaves_like 'load mentions from DB', :merge_request do + let(:project) { create(:project) } + let(:merge_request) { create(:merge_request, source_project: project, target_project: project) } + let(:note) { create(:note_on_merge_request, noteable: merge_request, project: merge_request.project) } + let(:mentionable) { note.noteable } + end + end +end + +describe Snippet, 'Mentionable' do + describe '#store_mentions!' do + it_behaves_like 'mentions in description', :project_snippet + it_behaves_like 'mentions in notes', :project_snippet do + let(:note) { create(:note_on_project_snippet) } + let(:mentionable) { note.noteable } + end + end + + describe 'load mentions' do + it_behaves_like 'load mentions from DB', :project_snippet do + let(:note) { create(:note_on_project_snippet) } + let(:mentionable) { note.noteable } + end + end end |