README.rdoc 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. = Rack::Test
  2. - Code: http://github.com/brynary/rack-test
  3. - Build: http://runcoderun.com/brynary/rack-test
  4. == Description
  5. Rack::Test is a small, simple testing API for Rack apps. It can be used on its
  6. own or as a reusable starting point for Web frameworks and testing libraries
  7. to build on. Most of its initial functionality is an extraction of Merb 1.0's
  8. request helpers feature.
  9. == Features
  10. * Maintains a cookie jar across requests
  11. * Easily follow redirects when desired
  12. * Set request headers to be used by all subsequent requests
  13. * Small footprint. Approximately 200 LOC
  14. == Example
  15. require "rack/test"
  16. class HomepageTest < Test::Unit::TestCase
  17. include Rack::Test::Methods
  18. def app
  19. MyApp.new
  20. end
  21. def test_redirect_logged_in_users_to_dashboard
  22. authorize "bryan", "secret"
  23. get "/"
  24. follow_redirect!
  25. assert_equal "http://example.org/redirected", last_request.url
  26. assert last_response.ok?
  27. end
  28. end
  29. == Install
  30. To install the latest release as a gem:
  31. sudo gem install rack-test
  32. == Authors
  33. - Maintained by {Bryan Helmkamp}[mailto:bryan@brynary.com]
  34. - Contributions from Simon Rozet and Pat Nakajima
  35. - Much of the original code was extracted from Merb 1.0's request helper
  36. == License
  37. Copyright (c) 2008-2009 Bryan Helmkamp, Engine Yard Inc.
  38. See MIT-LICENSE.txt in this directory.