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
mount_uploader :attachment, AttachmentUploader
# Scopes
scope :awards, ->{ where(is_award: true) }
scope :nonawards, ->{ where(is_award: false) }
scope :searchable, ->{ where("is_award IS FALSE AND system IS FALSE") }
scope :searchable, ->{ where(system: false) }
scope :for_commit_id, ->(commit_id) { where(noteable_type: "Commit", commit_id: commit_id) }
scope :system, ->{ where(system: true) }
scope :user, ->{ where(system: false) }
......@@ -111,7 +109,7 @@ class Note < ActiveRecord::Base
end
def searchable?
!is_award && !system
!system
end
def cross_reference?
......
......@@ -44,11 +44,6 @@ FactoryGirl.define do
system true
end
trait :award do
is_award true
note Emoji.emojis_names.sample
end
trait :downvote do
note "thumbsdown"
end
......
......@@ -42,14 +42,13 @@ describe "Note", elastic: true do
expect(note.as_indexed_json.keys).to eq(expected_hash_keys)
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
issue = create :issue, project: project
# 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, :award, project: project, noteable: issue
end
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