|
@@ -3,12 +3,6 @@
|
|
|
require 'rails_helper'
|
|
|
|
|
|
RSpec.describe 'HasSearchIndexBackend', type: :model, searchindex: true, performs_jobs: true do
|
|
|
- before do
|
|
|
- article && organization
|
|
|
-
|
|
|
- searchindex_model_reload([::Ticket, ::Organization])
|
|
|
- end
|
|
|
-
|
|
|
describe 'Updating referenced data between ticket and organizations' do
|
|
|
let(:organization) { create(:organization, name: 'Tomato42') }
|
|
|
let(:user) { create(:customer, organization: organization) }
|
|
@@ -25,6 +19,12 @@ RSpec.describe 'HasSearchIndexBackend', type: :model, searchindex: true, perform
|
|
|
article
|
|
|
end
|
|
|
|
|
|
+ before do
|
|
|
+ article && organization
|
|
|
+
|
|
|
+ searchindex_model_reload([::Ticket, ::Organization])
|
|
|
+ end
|
|
|
+
|
|
|
it 'finds added tickets' do
|
|
|
result = SearchIndexBackend.search('organization.name:Tomato42', 'Ticket', sort_by: ['updated_at'], order_by: ['desc'])
|
|
|
expect(result).to eq([{ id: ticket.id.to_s, type: 'Ticket' }])
|
|
@@ -81,4 +81,17 @@ RSpec.describe 'HasSearchIndexBackend', type: :model, searchindex: true, perform
|
|
|
expect(Ticket).not_to be_search_index_attribute_relevant('updated_by_id')
|
|
|
end
|
|
|
end
|
|
|
+
|
|
|
+ describe 'Updating group settings causes huge numbers of delayed jobs #4306' do
|
|
|
+ let(:ticket) { create(:ticket) }
|
|
|
+
|
|
|
+ before do
|
|
|
+ ticket
|
|
|
+ Delayed::Job.destroy_all
|
|
|
+ end
|
|
|
+
|
|
|
+ it 'does not create any jobs if nothing has changed' do
|
|
|
+ expect { ticket.update(title: ticket.title) }.not_to change(Delayed::Job, :count)
|
|
|
+ end
|
|
|
+ end
|
|
|
end
|