Commit 49bd4172 authored by Valery Sizov's avatar Valery Sizov

CE->EE fix Elastic related specs

parent a2eb6591
...@@ -41,9 +41,7 @@ class Note < ActiveRecord::Base ...@@ -41,9 +41,7 @@ class Note < ActiveRecord::Base
mount_uploader :attachment, AttachmentUploader mount_uploader :attachment, AttachmentUploader
# Scopes # Scopes
scope :awards, ->{ where(is_award: true) } scope :searchable, ->{ where(system: false) }
scope :nonawards, ->{ where(is_award: false) }
scope :searchable, ->{ where("is_award IS FALSE AND system IS FALSE") }
scope :for_commit_id, ->(commit_id) { where(noteable_type: "Commit", commit_id: commit_id) } scope :for_commit_id, ->(commit_id) { where(noteable_type: "Commit", commit_id: commit_id) }
scope :system, ->{ where(system: true) } scope :system, ->{ where(system: true) }
scope :user, ->{ where(system: false) } scope :user, ->{ where(system: false) }
...@@ -111,7 +109,7 @@ class Note < ActiveRecord::Base ...@@ -111,7 +109,7 @@ class Note < ActiveRecord::Base
end end
def searchable? def searchable?
!is_award && !system !system
end end
def cross_reference? def cross_reference?
......
...@@ -44,11 +44,6 @@ FactoryGirl.define do ...@@ -44,11 +44,6 @@ FactoryGirl.define do
system true system true
end end
trait :award do
is_award true
note Emoji.emojis_names.sample
end
trait :downvote do trait :downvote do
note "thumbsdown" note "thumbsdown"
end end
......
...@@ -42,14 +42,13 @@ describe "Note", elastic: true do ...@@ -42,14 +42,13 @@ describe "Note", elastic: true do
expect(note.as_indexed_json.keys).to eq(expected_hash_keys) expect(note.as_indexed_json.keys).to eq(expected_hash_keys)
end end
it "does not create ElasticIndexerWorker job for award or system messages" do it "does not create ElasticIndexerWorker job for system messages" do
project = create :project project = create :project
issue = create :issue, project: project issue = create :issue, project: project
# Only issue should be updated # Only issue should be updated
expect(ElasticIndexerWorker).to receive(:perform_async).twice.with(:update, 'Issue', anything, anything) expect(ElasticIndexerWorker).to receive(:perform_async).with(:update, 'Issue', anything, anything)
create :note, :system, project: project, noteable: issue create :note, :system, project: project, noteable: issue
create :note, :award, project: project, noteable: issue
end end
context 'notes to confidential issues' do context 'notes to confidential issues' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment