Class: Inferno::Web::Controllers::TestRuns::Show

Inherits:
Controller
  • Object
show all
Defined in:
lib/inferno/apps/web/controllers/test_runs/show.rb

Instance Method Summary collapse

Methods inherited from Controller

call, inherited, resource_class, resource_name

Instance Method Details

#handle(req, res) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/inferno/apps/web/controllers/test_runs/show.rb', line 10

def handle(req, res)
  test_run = repo.find(req.params[:id])
  halt 404 if test_run.nil?

  if req.params[:include_results] == 'true'
    results_repo = Inferno::Repositories::Results.new
    test_run.results =
      if req.params[:after].present?
        results_repo.test_run_results_after(test_run_id: test_run.id, after: Time.parse(req.params[:after]))
      else
        repo.results_for_test_run(test_run.id)
      end
  end

  test_session = test_sessions_repo.find(test_run.test_session_id)
  res.body = serialize(test_run, suite_options: test_session.suite_options)
end