diff options
author | Gareth Rees <gareth@mysociety.org> | 2014-09-17 17:09:25 +0100 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2014-09-25 12:57:55 +0100 |
commit | 2fdfd7b62e603b5f4d2ff5925a49b2d5ed83bf3b (patch) | |
tree | 2e8d8272beee078367caa4b7d7d8cfa326a3dc2f /spec | |
parent | dcd75661164ec372f35fdc7be498e004f8a0b768 (diff) |
Add an action to run the checks
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/health_checks_controller_spec.rb | 30 | ||||
-rw-r--r-- | spec/helpers/health_checks_helper_spec.rb | 15 |
2 files changed, 45 insertions, 0 deletions
diff --git a/spec/controllers/health_checks_controller_spec.rb b/spec/controllers/health_checks_controller_spec.rb new file mode 100644 index 000000000..f7ad6d6a4 --- /dev/null +++ b/spec/controllers/health_checks_controller_spec.rb @@ -0,0 +1,30 @@ +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') + +describe HealthChecksController do + + describe :index do + + describe :index do + + it 'returns a 200 if all health checks pass' do + HealthChecks.stub(:ok? => true) + get :index + expect(response.status).to eq(200) + end + + it 'returns a 500 if the health check fails' do + HealthChecks.stub(:ok? => false) + get :index + expect(response.status).to eq(500) + end + + it 'does not render a layout' do + get :index + expect(response).to render_template(:layout => false) + end + + end + + end + +end diff --git a/spec/helpers/health_checks_helper_spec.rb b/spec/helpers/health_checks_helper_spec.rb new file mode 100644 index 000000000..7d4083da5 --- /dev/null +++ b/spec/helpers/health_checks_helper_spec.rb @@ -0,0 +1,15 @@ +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') + +describe HealthChecksHelper do + include HealthChecksHelper + + describe :check_status do + + it 'warns that the check is failing' do + check = double(:message => 'Failed', :ok? => false) + expect(check_status(check)).to include('red') + end + + end + +end |