Sha256: 7ec1cba3434fde770cb8c77a26b9421c09d81c2b5bc3d8e567ff7d4392940289

Contents?: true

Size: 1005 Bytes

Versions: 2

Compression:

Stored size: 1005 Bytes

Contents

module JsTestCore
  module Resources
    class Suite < ThinRest::Resource
      class Collection < ThinRest::Resource
        route ANY do |env, id|
          Suite.new(env.merge(:id => id))
        end
      end

      RUNNING = 'running'
      SUCCESSFUL_COMPLETION = 'success'
      FAILURE_COMPLETION = 'failure'

      property :id

      def get
        runner = Runner.find(id)
        if runner
          connection.send_head
          if runner.running?
            connection.send_body("status=#{RUNNING}")
          else
            if runner.successful?
              connection.send_body("status=#{SUCCESSFUL_COMPLETION}")
            else
              connection.send_body("status=#{FAILURE_COMPLETION}&reason=#{runner.suite_run_result}")
            end
          end
        else
          connection.send_head(404)
          connection.send_body("")
        end
      end

      route 'finish' do |env, name|
        SuiteFinish.new(env.merge(:suite => self))
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
js_spec-0.3.2 vendor/js-test-core/lib/js_test_core/resources/suite.rb
screw-unit-0.3.1 vendor/js-test-core/lib/js_test_core/resources/suite.rb