2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
2020-09-11 07:25:47 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2021-04-28 07:36:59 +00:00
|
|
|
RSpec.describe Ticket::Article::AddsMetadataGeneral do
|
2020-09-11 07:25:47 +00:00
|
|
|
let(:agent) { create(:agent) }
|
|
|
|
|
2021-04-28 07:36:59 +00:00
|
|
|
context 'when Agent creates Article' do
|
|
|
|
shared_examples 'not including email in from' do |factory|
|
2021-07-16 13:38:01 +00:00
|
|
|
subject(:article) { create(:ticket_article, factory, ticket: ticket, created_by_id: agent.id, updated_by_id: agent.id) }
|
2020-09-11 07:25:47 +00:00
|
|
|
|
2021-04-28 07:36:59 +00:00
|
|
|
let(:ticket) { create(:ticket) }
|
|
|
|
let!(:agent) { create(:agent, groups: [ticket.group]) }
|
2020-09-11 07:25:47 +00:00
|
|
|
|
2021-04-28 07:36:59 +00:00
|
|
|
it "doesn't include email in from" do
|
|
|
|
expect(article.from).not_to include agent.email
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it_behaves_like 'not including email in from', :outbound_phone
|
|
|
|
it_behaves_like 'not including email in from', :outbound_web
|
|
|
|
|
|
|
|
context 'when as Customer' do
|
|
|
|
subject(:article) { create(:ticket_article, :inbound_phone, ticket: ticket) }
|
|
|
|
|
|
|
|
let(:customer) { agent }
|
|
|
|
let(:ticket) { create(:ticket, customer_id: customer.id) }
|
|
|
|
|
|
|
|
it 'includes email in from' do
|
|
|
|
expect(article.from).not_to include agent.email
|
|
|
|
end
|
2020-09-11 07:25:47 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|