Sha256: c01ceb614bb48d81541177eecd9222bccaf61d43ca6b1888ec760861527449e8
Contents?: true
Size: 1.57 KB
Versions: 3
Compression:
Stored size: 1.57 KB
Contents
module TestRunHelper def test_status(test) case test[:status].to_s when "pass"; "pass" when "skip"; "skip" when "fail", "regression"; "fail" else raise NotImplementedError.new "TestRunHelper#test_status doesn't know about the status #{test[:status].inspect}" end end def test_run_summary(test_run) subject = { "pass" => "#{test_run.total_count} tests passed!", "fail" => test_run_fail_summary(test_run), "error" => "tests are broken", "aborted" => "aborted" }.fetch( test_run.result.to_s, (test_run.created_at ? "started #{distance_of_time_in_words(test_run.created_at, Time.now)} ago" : "")) subject << " [#{test_run.branch}]" if test_run.branch subject end def test_run_fail_summary(test_run) if test_run.real_fail_count.zero? "the build exited unsuccessfully after running #{test_run.total_count} #{test_run.total_count == 1 ? "test" : "tests"}" else "#{test_run.real_fail_count} #{test_run.real_fail_count == 1 ? "test" : "tests"} failed" end end def commit_test_status(test_run, test_result) status = test_result.status if test_result status = "untested" if test_run.nil? status = "pending" if test_run && test_run.pending? status = "aborted" if test_run && test_run.aborted? status ||= "unknown" css = "project-test-status project-test-status-#{status}" if test_run link_to status, test_run_url(slug: test_run.project.slug, commit: test_run.sha), class: css else "<span class=\"#{css}\">#{status}</span>".html_safe end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
houston-core-0.6.0 | app/helpers/test_run_helper.rb |
houston-core-0.5.6 | app/helpers/test_run_helper.rb |
houston-core-0.5.5 | app/helpers/test_run_helper.rb |