Sha256: 04f57a9eba792c374c73f8158f9782e671ead37e665911a3efc091a765be0d95

Contents?: true

Size: 533 Bytes

Versions: 1

Compression:

Stored size: 533 Bytes

Contents

class ReportApp

  def url
    "http://localhost:#{port}"
  end

  def port
    1212
  end

  def start
    Rack::Handler::Thin.run(self, :Port => port)
  end

  def results
    @results ||= []
  end

  def call(env)
    r = Rack::Request.new(env)
    if r.post?
      results << JSON.parse(r.body.read)
    elsif r.get?
      case r.path
      when "/results"
        return [200, {}, [results.to_json]]
      when "/clear"
        results.clear
      else
        return [404, {}, []]
      end
    end

    [200, {}, []]
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cukeq-0.0.1.dev features/support/report_app.rb