2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
2020-02-13 08:27:36 +00:00
|
|
|
require 'rails_helper'
|
2021-04-12 09:49:26 +00:00
|
|
|
require 'models/concerns/has_xss_sanitized_note_examples'
|
2020-02-13 08:27:36 +00:00
|
|
|
|
|
|
|
RSpec.describe Chat, type: :model do
|
2021-04-12 09:49:26 +00:00
|
|
|
it_behaves_like 'HasXssSanitizedNote', model_factory: :chat
|
2020-02-13 08:27:36 +00:00
|
|
|
|
2021-07-12 13:18:31 +00:00
|
|
|
describe 'website allowing' do
|
|
|
|
let(:chat) { create(:chat, allowed_websites: 'zammad.org') }
|
2020-02-13 08:27:36 +00:00
|
|
|
|
2021-07-12 13:18:31 +00:00
|
|
|
it 'detects allowed website' do
|
|
|
|
result = chat.website_allowed?('https://www.zammad.org')
|
2020-02-13 08:27:36 +00:00
|
|
|
expect(result).to be true
|
|
|
|
end
|
|
|
|
|
2021-07-12 13:18:31 +00:00
|
|
|
it 'detects non-allowed website' do
|
|
|
|
result = chat.website_allowed?('https://www.zammad.com')
|
2020-02-13 08:27:36 +00:00
|
|
|
expect(result).to be false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|