github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/integration/assets/service_broker/spec/spec_helper.rb (about)

     1  ENV['RACK_ENV'] = 'test'
     2  
     3  $: << File.expand_path("../../.", __FILE__)
     4  
     5  require 'service_broker'
     6  require 'rspec'
     7  require 'rack/test'
     8  
     9  module AsyncHelper
    10    def eventually(options = {})
    11      timeout = options[:timeout] || 2
    12      interval = options[:interval] || 0.1
    13      time_limit = Time.now + timeout
    14      loop do
    15        begin
    16          yield
    17        rescue => error
    18        end
    19        return if error.nil?
    20        raise error if Time.now >= time_limit
    21        sleep interval
    22      end
    23    end
    24  end
    25  
    26  RSpec.configure do |conf|
    27    conf.include Rack::Test::Methods
    28    #conf.include AsyncHelper
    29  
    30    def app
    31      ServiceBroker
    32    end
    33  end