Sha256: 140018e47f570c25ac2efe778ca9f71d70c6572d923a9dd33f81ed55f1fbce59

Contents?: true

Size: 987 Bytes

Versions: 5

Compression:

Stored size: 987 Bytes

Contents

require 'common'
require 'fastly'
require 'minitest/autorun'

# Accommodate a more modern version of Minitest compared to the stdlib
if defined? Minitest::Test
  class Fastly::TestCase < Minitest::Test
  end
else
  class Fastly::TestCase < MiniTest::Unit::TestCase
  end
end

class Fastly::TestCase
  # Map inconsistency between Test::Unit and Minitest
  alias :assert_raise :assert_raises
end

def login_opts(mode=:full)
  opts = { }
  [:url,:port].each do |what|
    key = "FASTLY_TEST_BASE_#{what.to_s.upcase}"
    opts["base_#{what}".to_sym] = ENV[key] if ENV.has_key?(key)
  end

  required = :full == mode ? [:user, :name, :password, :customer] : [:api_key, :customer]
  required.each do |what|
      key ="FASTLY_TEST_#{what.to_s.upcase}"
      unless ENV.has_key?(key)
        warn "You haven't set the environment variable #{key}"
        exit(-1)
      end
      opts[what] = ENV[key]
  end
  opts
end

def get_rand
  "#{Process.pid}-#{Time.now.to_i}-#{Kernel.rand(1000)}"
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fastly-1.1.4 test/helper.rb
fastly-1.1.3 test/helper.rb
fastly-1.1.2 test/helper.rb
fastly-1.1.1 test/helper.rb
fastly-1.1.0 test/helper.rb