Sha256: a2e3b9ab01d51ba99ccf3409b2c082e03efbc02b52f1d94e7a7534708f7b897c

Contents?: true

Size: 786 Bytes

Versions: 4

Compression:

Stored size: 786 Bytes

Contents

require 'turn'
require 'mocha'
require 'sinatra/test_helpers'
require 'minitest/autorun'
require 'rack/test'

ENV['RACK_ENV'] = 'test'
include Rack::Test::Methods

# require the app itself
require 'batsd-dash'

# setup a MockSesion
module Rack
  class MockSession
    alias_method :request_original, :request
    def request(uri, env)
      EM.synchrony { EM.next_tick { request_original(uri, env); EM.stop } }
    end
  end
end


class MiniTest::Spec
  after { mocha_teardown }

  def app
    BatsdDash::App
  end

  def json_response
    oid = last_response.object_id

    if oid != @last_response_id
      @last_response_id = oid
      @last_response_json_body = Yajl::Parser.parse(last_response.body, symbolize_keys: true) rescue nil
    end

    @last_response_json_body
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
batsd-dash-0.3.1 test/helper.rb
batsd-dash-0.3.0 test/helper.rb
batsd-dash-0.2.1 test/helper.rb
batsd-dash-0.2.0 test/helper.rb