chore: Add climate-control gem for handling the test ENV vars (#3267)

This commit is contained in:
Akhil G Krishnan
2021-10-25 13:13:25 +05:30
committed by GitHub
parent 06289b03ea
commit 84df9c807d
8 changed files with 85 additions and 81 deletions

View File

@@ -27,18 +27,16 @@ RSpec.describe 'Integration Apps API', type: :request do
end
it 'returns slack app with appropriate redirect url when configured' do
ENV['SLACK_CLIENT_ID'] = 'client_id'
ENV['SLACK_CLIENT_SECRET'] = 'client_secret'
get api_v1_account_integrations_apps_url(account),
headers: agent.create_new_auth_token,
as: :json
with_modified_env SLACK_CLIENT_ID: 'client_id', SLACK_CLIENT_SECRET: 'client_secret' do
get api_v1_account_integrations_apps_url(account),
headers: agent.create_new_auth_token,
as: :json
expect(response).to have_http_status(:success)
apps = JSON.parse(response.body)['payload']
slack_app = apps.find { |app| app['id'] == 'slack' }
expect(slack_app['action']).to include('client_id=client_id')
ENV['SLACK_CLIENT_ID'] = nil
ENV['SLACK_CLIENT_SECRET'] = nil
expect(response).to have_http_status(:success)
apps = JSON.parse(response.body)['payload']
slack_app = apps.find { |app| app['id'] == 'slack' }
expect(slack_app['action']).to include('client_id=client_id')
end
end
end
end