From ae5deca24b2b96bd6e3b96888869949ca37afff6 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Tue, 9 May 2023 13:34:11 +0530 Subject: [PATCH] test: update to check for preloaded_label_list --- spec/models/conversation_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spec/models/conversation_spec.rb b/spec/models/conversation_spec.rb index 514fb80c5..f4208081d 100644 --- a/spec/models/conversation_spec.rb +++ b/spec/models/conversation_spec.rb @@ -243,6 +243,13 @@ RSpec.describe Conversation, type: :model do expect(conversation.label_list).to match_array(labels) end + it 'ensures preloaded labels are always in sync with the database' do + labels = [first_label, fourth_label].map(&:title) + expect(conversation.update_labels(labels)).to be(true) + expect(conversation.label_list).to match_array(labels) + expect(conversation.preloaded_label_list).to match_array(labels) + end + it 'adds and removes previously added labels' do labels = [first_label, fourth_label].map(&:title) expect { conversation.update_labels(labels) }