Skip to content

Instantly share code, notes, and snippets.

@paneq
Created November 4, 2012 00:38
Show Gist options
  • Save paneq/4009602 to your computer and use it in GitHub Desktop.
Save paneq/4009602 to your computer and use it in GitHub Desktop.
HTTP Response chainable API :)
def test_getters
ok = Response.new.http_version(v = 'HTTP/1.0').status(s = 300).headers({'X-Man' => xman = 'Summers'}).header("X-Angel", angel = "Warren").body(data = 'data')
assert_equal v, ok.http_version
assert_equal s, ok.status
assert_equal xman, ok.header("X-Man")
assert_equal angel, ok.header("X-Angel")
assert_equal data , ok.body
assert_equal 2, ok.headers.size
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment