Sha256: 4942b22084eefac5ae17660b6fb5b67ee8a5827a4c5c2776de9dfc34aa8e739e

Contents?: true

Size: 618 Bytes

Versions: 4

Compression:

Stored size: 618 Bytes

Contents

class FakeHttpClient < RedisRing::HttpClient

  def posts
    @posts ||= []
  end

  def gets
    @gets ||= []
  end

  def responses
    @responses ||= Hash.new("OK")
  end

  def post(host, port, path, params = {})
    url = uri(host, port, path, params).to_s
    posts << url
    return responses[url]
  end

  def get(host, port, path, params = {})
    url = uri(host, port, path, params).to_s
    gets << url
    return responses[url]
  end

  def set_response(url, text)
    responses[url] = text
  end

  def sent_post?(url)
    posts.include?(url)
  end

  def sent_get?(url)
    gets.include?(url)
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
redis_ring-0.1.3 spec/fakes/fake_http_client.rb
redis_ring-0.1.2 spec/fakes/fake_http_client.rb
redis_ring-0.1.1 spec/fakes/fake_http_client.rb
redis_ring-0.1.0 spec/fakes/fake_http_client.rb