chat_spec.rb 599 B

1234567891011121314151617181920
  1. require 'rails_helper'
  2. require 'models/concerns/has_xss_sanitized_note_examples'
  3. RSpec.describe Chat, type: :model do
  4. it_behaves_like 'HasXssSanitizedNote', model_factory: :chat
  5. describe 'website whitelisting' do
  6. let(:chat) { create(:chat, whitelisted_websites: 'zammad.org') }
  7. it 'detects whitelisted website' do
  8. result = chat.website_whitelisted?('https://www.zammad.org')
  9. expect(result).to be true
  10. end
  11. it 'detects non-whitelisted website' do
  12. result = chat.website_whitelisted?('https://www.zammad.com')
  13. expect(result).to be false
  14. end
  15. end
  16. end