diff options
Diffstat (limited to 'spec/config/mail_room_spec.rb')
-rw-r--r-- | spec/config/mail_room_spec.rb | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/spec/config/mail_room_spec.rb b/spec/config/mail_room_spec.rb index a3806fb3cb6..05230b65956 100644 --- a/spec/config/mail_room_spec.rb +++ b/spec/config/mail_room_spec.rb @@ -9,24 +9,13 @@ RSpec.describe 'mail_room.yml', feature_category: :service_desk do let(:gitlab_config_path) { 'config/mail_room.yml' } let(:queues_config_path) { 'config/redis.queues.yml' } - let(:configuration) do - vars = { - 'MAIL_ROOM_GITLAB_CONFIG_FILE' => absolute_path(gitlab_config_path), - 'GITLAB_REDIS_QUEUES_CONFIG_FILE' => absolute_path(queues_config_path) - } - cmd = "puts ERB.new(File.read(#{absolute_path(mailroom_config_path).inspect})).result" - - result = Gitlab::Popen.popen_with_detail(%W(ruby -rerb -e #{cmd}), absolute_path('config'), vars) - output = result.stdout - errors = result.stderr - status = result.status - raise "Error interpreting #{mailroom_config_path}: #{output}\n#{errors}" unless status == 0 - - YAML.safe_load(output, permitted_classes: [Symbol]) - end + let(:configuration) { YAML.safe_load(ERB.new(File.read(mailroom_config_path)).result, permitted_classes: [Symbol]) } before do - stub_env('GITLAB_REDIS_QUEUES_CONFIG_FILE', absolute_path(queues_config_path)) + stub_env('MAIL_ROOM_GITLAB_CONFIG_FILE', absolute_path(gitlab_config_path)) + allow(Gitlab::Redis::Queues).to receive(:config_file_name).and_return(queues_config_path) + Gitlab::MailRoom.instance_variable_set(:@enabled_configs, nil) + Gitlab::MailRoom.instance_variable_set(:@yaml, nil) end context 'when incoming email is disabled' do |