Sha256: 689f8ae462d8c5bf18ef02d1905e2f6c764101f8e2d1797d979bc0f75e41a045

Contents?: true

Size: 1.1 KB

Versions: 26

Compression:

Stored size: 1.1 KB

Contents

module Inferno
  module Web
    module Controllers
      module TestSessions
        class ClientShow < Controller
          config.default_response_format = :html

          CLIENT_PAGE =
            ERB.new(
              File.read(
                File.join(
                  Inferno::Application.root, 'lib', 'inferno', 'apps', 'web', 'index.html.erb'
                )
              )
            ).result.freeze

          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.body = CLIENT_PAGE
          end
        end
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
inferno_core-0.4.35 lib/inferno/apps/web/controllers/test_sessions/client_show.rb
inferno_core-0.4.34 lib/inferno/apps/web/controllers/test_sessions/client_show.rb
inferno_core-0.4.33 lib/inferno/apps/web/controllers/test_sessions/client_show.rb
inferno_core-0.4.32 lib/inferno/apps/web/controllers/test_sessions/client_show.rb
inferno_core-0.4.31 lib/inferno/apps/web/controllers/test_sessions/client_show.rb
inferno_core-0.4.30 lib/inferno/apps/web/controllers/test_sessions/client_show.rb
inferno_core-0.4.29 lib/inferno/apps/web/controllers/test_sessions/client_show.rb
inferno_core-0.4.28 lib/inferno/apps/web/controllers/test_sessions/client_show.rb
inferno_core-0.4.27 lib/inferno/apps/web/controllers/test_sessions/client_show.rb
inferno_core-0.4.26 lib/inferno/apps/web/controllers/test_sessions/client_show.rb
inferno_core-0.4.25 lib/inferno/apps/web/controllers/test_sessions/client_show.rb
inferno_core-0.4.24 lib/inferno/apps/web/controllers/test_sessions/client_show.rb
inferno_core-0.4.23 lib/inferno/apps/web/controllers/test_sessions/client_show.rb
inferno_core-0.4.22 lib/inferno/apps/web/controllers/test_sessions/client_show.rb
inferno_core-0.4.21 lib/inferno/apps/web/controllers/test_sessions/client_show.rb
inferno_core-0.4.20 lib/inferno/apps/web/controllers/test_sessions/client_show.rb
inferno_core-0.4.19 lib/inferno/apps/web/controllers/test_sessions/client_show.rb
inferno_core-0.4.18 lib/inferno/apps/web/controllers/test_sessions/client_show.rb
inferno_core-0.4.17 lib/inferno/apps/web/controllers/test_sessions/client_show.rb
inferno_core-0.4.16 lib/inferno/apps/web/controllers/test_sessions/client_show.rb