summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorJarka Kadlecova <jarka@gitlab.com>2017-01-18 18:37:55 -0500
committerJarka Kadlecova <jarka@gitlab.com>2017-01-18 18:38:17 -0500
commitbf708e55c2e6035b64861a1cda8bfe3d3b4a2105 (patch)
tree6eb5f726e0d033a6a69ea1ad900223ef4ef30054 /spec/models
parentd6b11dafd37e78c12c982c42f274928293cdfa53 (diff)
downloadgitlab-ce-bf708e55c2e6035b64861a1cda8bfe3d3b4a2105.tar.gz
make mentions working when project not specified
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/concerns/mentionable_spec.rb13
-rw-r--r--spec/models/note_spec.rb2
2 files changed, 14 insertions, 1 deletions
diff --git a/spec/models/concerns/mentionable_spec.rb b/spec/models/concerns/mentionable_spec.rb
index 8321e0b89f8..63eb7473c97 100644
--- a/spec/models/concerns/mentionable_spec.rb
+++ b/spec/models/concerns/mentionable_spec.rb
@@ -30,12 +30,23 @@ describe Issue, "Mentionable" do
describe '#mentioned_users' do
let!(:user) { create(:user, username: 'stranger') }
let!(:user2) { create(:user, username: 'john') }
- let!(:issue) { create(:issue, description: "#{user.to_reference} mentioned") }
+ let!(:user3) { create(:user, username: 'jim') }
+ let(:issue) { create(:issue, description: "#{user.to_reference} mentioned") }
subject { issue.mentioned_users }
it { is_expected.to include(user) }
it { is_expected.not_to include(user2) }
+
+ context 'when a note on personal snippet' do
+ let!(:note) { create(:note_on_personal_snippet, note: "#{user.to_reference} mentioned #{user3.to_reference}") }
+
+ subject { note.mentioned_users }
+
+ it { is_expected.to include(user) }
+ it { is_expected.to include(user3) }
+ it { is_expected.not_to include(user2) }
+ end
end
describe '#referenced_mentionables' do
diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb
index ddd62d7f0e6..8017bf7a13c 100644
--- a/spec/models/note_spec.rb
+++ b/spec/models/note_spec.rb
@@ -152,6 +152,7 @@ describe Note, models: true do
with([{
text: note1.note,
context: {
+ skip_project_check: false,
pipeline: :note,
cache_key: [note1, "note"],
project: note1.project,
@@ -163,6 +164,7 @@ describe Note, models: true do
with([{
text: note2.note,
context: {
+ skip_project_check: false,
pipeline: :note,
cache_key: [note2, "note"],
project: note2.project,