From 05fb40a3f8dd7f3c30d497d9c479420120f0114f Mon Sep 17 00:00:00 2001 From: Mantas Date: Tue, 16 Jun 2020 01:11:29 +0300 Subject: [PATCH] Maintenance: Make S/MIME system spec more stable by applying temporary "`Setting.set` before authenticated" workaround. --- spec/system/ticket/create_spec.rb | 12 +++++++----- spec/system/ticket/zoom_spec.rb | 6 +++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/spec/system/ticket/create_spec.rb b/spec/system/ticket/create_spec.rb index 915052d37..6862923f0 100644 --- a/spec/system/ticket/create_spec.rb +++ b/spec/system/ticket/create_spec.rb @@ -22,14 +22,15 @@ RSpec.describe 'Ticket Create', type: :system do 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' @@ -55,7 +56,8 @@ RSpec.describe 'Ticket Create', type: :system do 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' } diff --git a/spec/system/ticket/zoom_spec.rb b/spec/system/ticket/zoom_spec.rb index 37aae6f57..ab3d28971 100644 --- a/spec/system/ticket/zoom_spec.rb +++ b/spec/system/ticket/zoom_spec.rb @@ -395,8 +395,7 @@ RSpec.describe 'Ticket zoom', type: :system do 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) } @@ -408,8 +407,9 @@ RSpec.describe 'Ticket zoom', type: :system do 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