diff options
Diffstat (limited to 'spec/models/concerns/pg_full_text_searchable_spec.rb')
-rw-r--r-- | spec/models/concerns/pg_full_text_searchable_spec.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/spec/models/concerns/pg_full_text_searchable_spec.rb b/spec/models/concerns/pg_full_text_searchable_spec.rb index db7f652f494..b6da481024a 100644 --- a/spec/models/concerns/pg_full_text_searchable_spec.rb +++ b/spec/models/concerns/pg_full_text_searchable_spec.rb @@ -54,12 +54,23 @@ RSpec.describe PgFullTextSearchable do end context 'when specified columns are not changed' do - it 'does not enqueue worker' do + it 'does not call update_search_data!' do expect(model).not_to receive(:update_search_data!) model.update!(description: 'A new description') end end + + context 'when model is updated twice within a transaction' do + it 'calls update_search_data!' do + expect(model).to receive(:update_search_data!) + + model.transaction do + model.update!(title: 'A new title') + model.update!(updated_at: Time.current) + end + end + end end describe '.pg_full_text_search' do |