session_spec.rb 675 B

123456789101112131415161718192021222324
  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) { create(:chat) }
  6. let(:chat_user) { create(:agent) }
  7. it 'verify message attribute' do
  8. expect(chat_session.search_index_attribute_lookup['messages']).to eq []
  9. end
  10. it 'verify user attribute' do
  11. expect(chat_session.search_index_attribute_lookup['user']['id']).to eq chat_user.id
  12. end
  13. it 'verify chat attribute' do
  14. expect(chat_session.search_index_attribute_lookup['chat']['name']).to eq chat.name
  15. end
  16. end
  17. end