Sha256: 7701cf2327086e739d8579ed43b866c5ccc3c29eecc6ca58afd939a262b7d153

Contents?: true

Size: 856 Bytes

Versions: 4

Compression:

Stored size: 856 Bytes

Contents

require 'common'
require 'fastly'
require 'minitest/autorun'
require 'pry'
require 'dotenv/load'

class Fastly
  class TestCase < Minitest::Test; end
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.key?(key)
  end

  required = case mode
             when :full
               [:user, :password]
             when :both
               [:user, :password, :api_key]
             else
               [:api_key]
             end

  required.each do |what|
    key = "FASTLY_TEST_#{what.to_s.upcase}"
    unless ENV.key?(key)
      warn "You haven't set the environment variable #{key}"
      exit(-1)
    end
    opts[what] = ENV[key]
  end
  opts
end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fastly-3.0.2 test/helper.rb
fastly-3.0.1 test/helper.rb
fastly-3.0.0 test/helper.rb
fastly-2.5.3 test/helper.rb