Sha256: da80c051366d9f944b593b56d0c1cf832602a5b03186ebb37aff287efdae5dde

Contents?: true

Size: 949 Bytes

Versions: 3

Compression:

Stored size: 949 Bytes

Contents

require 'scales-monitor'
require "net/http"
require "uri"

module Helpers
  
  def async
    if EM.reactor_running?
      yield
    else
      out = nil
      EM.synchrony do
        out = yield
        EM.stop
      end
      out
    end
  end
  
  def get url
    uri     = URI.parse(url)
    http    = Net::HTTP.new(uri.host, uri.port)
    request = Net::HTTP::Get.new(uri.request_uri)

    http.request(request)
  end
  
  def post url, data = {}
    uri = URI.parse(url)
    Net::HTTP.post_form(uri, data)
  end
  
  def fixture(file)
    File.read(File.expand_path("../fixtures/#{file}", __FILE__))
  end
  
  def squeeze string
    string.gsub(/(\n|\t|\r)/, ' ').gsub(/>\s*</, '><').squeeze(' ').strip
  end
  
end

RSpec.configure do |config|
  config.include Helpers
  config.include Goliath::TestHelper
  config.treat_symbols_as_metadata_keys_with_true_values = true
  config.before(:suite) do
    Scales::Storage::Sync.flushall!
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
scales-monitor-0.0.4 spec/helper.rb
scales-monitor-0.0.1.beta.2 spec/helper.rb
scales-monitor-0.0.1.beta.1 spec/helper.rb