Skip to content

Commit

Permalink
Maintenance: Make S/MIME system spec more stable by applying temporar…
Browse files Browse the repository at this point in the history
…y "`Setting.set` before authenticated" workaround.
  • Loading branch information
mantas authored and thorsteneckel committed Jun 18, 2020
1 parent 0f5b102 commit 05fb40a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
12 changes: 7 additions & 5 deletions spec/system/ticket/create_spec.rb
Expand Up @@ -22,14 +22,15 @@
include_examples 'text modules', path: 'ticket/create'
end

context 'S/MIME' do

prepend_before do
context 'S/MIME', authenticated_as: :authenticate do
def authenticate
Setting.set('smime_integration', true)
current_user
end

context 'no certificate present' do
let!(:template) { create(:template, :dummy_data) }
let!(:template) { create(:template, :dummy_data) }
let(:current_user) { true }

it 'has no security selections' do
visit 'ticket/create'
Expand All @@ -55,7 +56,8 @@
end
end

context 'private key configured', authenticated_as: :agent do
context 'private key configured' do
let(:current_user) { agent }
let!(:template) { create(:template, :dummy_data, group: group, owner: agent, customer: customer) }

let(:system_email_address) { 'smime1@example.com' }
Expand Down
6 changes: 3 additions & 3 deletions spec/system/ticket/zoom_spec.rb
Expand Up @@ -395,8 +395,7 @@ def create_ticket_article(sender_name:, internal:, type_name:, updated_by:)
end
end

context 'S/MIME active', authenticated_as: :agent do

context 'S/MIME active', authenticated_as: :authenticate do
let(:system_email_address) { 'smime1@example.com' }
let(:email_address) { create(:email_address, email: system_email_address) }
let(:group) { create(:group, email_address: email_address) }
Expand All @@ -408,8 +407,9 @@ def create_ticket_article(sender_name:, internal:, type_name:, updated_by:)

let!(:ticket) { create(:ticket, group: group, owner: agent, customer: customer) }

before do
def authenticate
Setting.set('smime_integration', true)
agent
end

context 'received mail' do
Expand Down

0 comments on commit 05fb40a

Please sign in to comment.