Sha256: 45005d2bf573a39c3db96b0c322380543aab0f43165354d9977e2b3df3510feb

Contents?: true

Size: 954 Bytes

Versions: 2

Compression:

Stored size: 954 Bytes

Contents

# test/test_helper.rb

ENV["TEST"] = 'true'
ENV["DATABASE_URL"] ||= "postgres:///queue_classic_test"

$:.unshift File.expand_path("../../lib")
require 'rubygems'
require 'minitest/autorun'
require 'pry'
require 'time'

require 'heroku-qc-autoscale'
Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|f| require f}

Heroku::QC::Autoscale.config do |c|
  c.api_key = "123456"
  c.app     = "racehq-test"
  c.mock    = true
  c.scale   = [1, 15, 30, 40, 50]
  c.active  = true
end

# borrowed from heroku-api test helper
def with_app(params={}, &block)
  params.merge!('name' => Heroku::QC::Autoscale.app) unless params.key?("name")
  heroku = Heroku::Scaler.client
  
  begin
    data = heroku.post_app(params).body
    @name = data['name']
    ready = false
    until ready
      ready = heroku.request(:method => :put, :path => "/apps/#{@name}/status").status == 201
    end
    yield(data)
  ensure
    heroku.delete_app(@name) rescue nil
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
heroku-qc-autoscale-0.0.2 test/test_helper.rb
heroku-qc-autoscale-0.0.1 test/test_helper.rb