session_spec.rb 800 B

1234567891011121314151617181920212223242526272829
  1. require 'rails_helper'
  2. RSpec.describe Chat::Session, type: :model do
  3. describe '.search_index_attribute_lookup' do
  4. subject(:chat_session) { create(:'chat/session', user: chat_user, chat: chat) }
  5. let(:chat_message) { create(:'chat/message', chat_session: chat_session) }
  6. let(:chat) { create(:chat) }
  7. let(:chat_user) { create(:agent) }
  8. before do
  9. chat_message
  10. end
  11. it 'verify message attribute' do
  12. expect(chat_session.search_index_attribute_lookup['messages']).not_to eq []
  13. end
  14. it 'verify user attribute' do
  15. expect(chat_session.search_index_attribute_lookup['user']['id']).to eq chat_user.id
  16. end
  17. it 'verify chat attribute' do
  18. expect(chat_session.search_index_attribute_lookup['chat']['name']).to eq chat.name
  19. end
  20. end
  21. end