summaryrefslogtreecommitdiff
path: root/spec/controllers/health_check_controller_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/controllers/health_check_controller_spec.rb')
-rw-r--r--spec/controllers/health_check_controller_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/controllers/health_check_controller_spec.rb b/spec/controllers/health_check_controller_spec.rb
index 15b3cacf623..6c545169450 100644
--- a/spec/controllers/health_check_controller_spec.rb
+++ b/spec/controllers/health_check_controller_spec.rb
@@ -5,6 +5,7 @@ describe HealthCheckController do
let(:json_response) { JSON.parse(response.body) }
let(:xml_response) { Hash.from_xml(response.body)['hash'] }
+ let(:token) { current_application_settings.health_check_access_token }
let(:whitelisted_ip) { '127.0.0.1' }
let(:not_whitelisted_ip) { '127.0.0.2' }
@@ -23,6 +24,21 @@ describe HealthCheckController do
get :index
expect(response).to be_not_found
end
+
+ context 'when services are accessed with token' do
+ it 'supports passing the token in the header' do
+ request.headers['TOKEN'] = token
+ get :index
+ expect(response).to be_success
+ expect(response.content_type).to eq 'text/plain'
+ end
+
+ it 'supports successful plaintest response' do
+ get :index, token: token
+ expect(response).to be_success
+ expect(response.content_type).to eq 'text/plain'
+ end
+ end
end
context 'when services are up and accessed from whitelisted ips' do