Class: Inferno::Web::Controllers::TestSessions::ClientShow
- Inherits:
-
Controller
- Object
- Hanami::Action
- Controller
- Inferno::Web::Controllers::TestSessions::ClientShow
- Defined in:
- lib/inferno/apps/web/controllers/test_sessions/client_show.rb
Constant Summary collapse
- CLIENT_PAGE =
ERB.new( File.read( File.join( Inferno::Application.root, 'lib', 'inferno', 'apps', 'web', 'index.html.erb' ) ) ).result.freeze
Instance Method Summary collapse
Methods inherited from Controller
call, inherited, resource_class, resource_name
Instance Method Details
#handle(req, res) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/inferno/apps/web/controllers/test_sessions/client_show.rb', line 15 def handle(req, res) test_session_id = req.params[:id] test_suite_id = req.params[:test_suite_id] test_session = repo.find(test_session_id) halt 404 if test_session.nil? if test_suite_id.blank? || test_suite_id != test_session.test_suite_id test_suite_id = test_session.test_suite_id res.redirect_to "#{Inferno::Application['base_url']}/#{test_suite_id}/#{test_session_id}" end test_suite = Inferno::Repositories::TestSuites.new.find(test_suite_id) halt 404 if test_suite.nil? res.format = :html res.body = CLIENT_PAGE end |