From c74291a001920dd0d0c6836f78c1e73c6687d284 Mon Sep 17 00:00:00 2001 From: MichaelAChrisco Date: Fri, 3 Apr 2015 15:26:59 -0700 Subject: [PATCH] multiple view states --- spec/web_spec.rb | 12 ++++++++++++ web/views/dashboard.haml | 8 +++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/spec/web_spec.rb b/spec/web_spec.rb index 5e2590e..fb5bc76 100644 --- a/spec/web_spec.rb +++ b/spec/web_spec.rb @@ -29,6 +29,18 @@ describe Crono::Web do get '/' expect(last_response.body).to include 'Error' end + + it 'should show a success mark when a job is healthy' do + @test_job.update(healthy: true) + get '/' + expect(last_response.body).to include 'Success' + end + + it 'should show a pending mark when a job is pending' do + @test_job.update(healthy: nil) + get '/' + expect(last_response.body).to include 'Pending' + end end describe '/job/:id' do diff --git a/web/views/dashboard.haml b/web/views/dashboard.haml index 69f0f5e..5ee4d35 100644 --- a/web/views/dashboard.haml +++ b/web/views/dashboard.haml @@ -6,7 +6,7 @@ %tr %th Job %th Last performed at - %th + %th Status %th - @jobs.each do |job| %tr @@ -16,6 +16,12 @@ - if job.healthy == false %a{ href: url("/job/#{job.id}") } %span.label.label-danger Error + - if job.healthy == true + %a{ href: url("/job/#{job.id}") } + %span.label.label-success Success + - else + %a{ href: url("/job/#{job.id}") } + %span.label.label-default Pending %td %a{ href: url("/job/#{job.id}") } Log