Sha256: 741643be92d4211cb76095b879a57050237e8747dba525d7f87f18253e8a1a5a

Contents?: true

Size: 500 Bytes

Versions: 28

Compression:

Stored size: 500 Bytes

Contents

require 'active_resource'

module RestAssured
  class MoreRequestsExpected < StandardError; end

  class Double < ActiveResource::Base
    def response_headers
      attributes[:response_headers].attributes
    end

    def wait_for_requests(n, opts = {})
      timeout = opts[:timeout] || 5

      timeout.times do
        sleep 1
        reload
        return if requests.count >= n
      end
      raise MoreRequestsExpected.new("Expected #{n} requests. Got #{requests.count}.")
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
rest-assured-4.0.0 lib/rest-assured/api/resources.rb
rest-assured-3.0.1 lib/rest-assured/api/resources.rb
rest-assured-3.0.0 lib/rest-assured/api/resources.rb
rest-assured-2.2.0 lib/rest-assured/api/resources.rb
rest-assured-2.1.0 lib/rest-assured/api/resources.rb
rest-assured-2.0.2 lib/rest-assured/api/resources.rb
rest-assured-2.0.1 lib/rest-assured/api/resources.rb
rest-assured-2.0.0 lib/rest-assured/api/resources.rb
rest-assured-1.2.2 lib/rest-assured/api/resources.rb
rest-assured-1.2.1 lib/rest-assured/api/resources.rb
rest-assured-1.2.0 lib/rest-assured/api/resources.rb
rest-assured-1.1.10 lib/rest-assured/api/resources.rb
rest-assured-1.1.9 lib/rest-assured/api/resources.rb
rest-assured-1.1.8 lib/rest-assured/api/resources.rb
rest-assured-1.1.7 lib/rest-assured/api/resources.rb
rest-assured-1.1.6 lib/rest-assured/api/resources.rb
rest-assured-1.1.5 lib/rest-assured/api/resources.rb
rest-assured-1.1.4 lib/rest-assured/api/resources.rb
rest-assured-1.1.3 lib/rest-assured/api/resources.rb
rest-assured-1.1.2 lib/rest-assured/api/resources.rb