diff options
author | Alejandro RodrÃguez <alejorro70@gmail.com> | 2017-09-01 00:00:40 +0300 |
---|---|---|
committer | Alejandro RodrÃguez <alejorro70@gmail.com> | 2017-09-06 02:12:18 +0300 |
commit | 8323e55b6c0d59627c584b49e70d4f6ccfd3c8f0 (patch) | |
tree | 7469c1bedb6b2023cb93e67ecb2cbf3c430b1c3c /spec/requests/api/internal_spec.rb | |
parent | 063e285e6a8c26a95809873fb32fefc54fe9bdb6 (diff) |
Return a value to check if redis is available on /internal/check
Diffstat (limited to 'spec/requests/api/internal_spec.rb')
-rw-r--r-- | spec/requests/api/internal_spec.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/requests/api/internal_spec.rb b/spec/requests/api/internal_spec.rb index a6c804fb2b3..1494c451543 100644 --- a/spec/requests/api/internal_spec.rb +++ b/spec/requests/api/internal_spec.rb @@ -8,10 +8,21 @@ describe API::Internal do describe "GET /internal/check" do it do + expect_any_instance_of(Redis).to receive(:ping).and_return('PONG') + get api("/internal/check"), secret_token: secret_token expect(response).to have_http_status(200) expect(json_response['api_version']).to eq(API::API.version) + expect(json_response['redis']).to be(true) + end + + it 'returns false for field `redis` when redis is unavailable' do + expect_any_instance_of(Redis).to receive(:ping).and_raise(Errno::ENOENT) + + get api("/internal/check"), secret_token: secret_token + + expect(json_response['redis']).to be(false) end end |