chat_spec.rb 652 B

12345678910111213141516171819202122
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. require 'models/concerns/has_xss_sanitized_note_examples'
  4. RSpec.describe Chat, type: :model do
  5. it_behaves_like 'HasXssSanitizedNote', model_factory: :chat
  6. describe 'website allowing' do
  7. let(:chat) { create(:chat, allowed_websites: 'zammad.org') }
  8. it 'detects allowed website' do
  9. result = chat.website_allowed?('https://www.zammad.org')
  10. expect(result).to be true
  11. end
  12. it 'detects non-allowed website' do
  13. result = chat.website_allowed?('https://www.zammad.com')
  14. expect(result).to be false
  15. end
  16. end
  17. end