diff --git a/README.rdoc b/README.rdoc index eef8c409..8dc6979f 100644 --- a/README.rdoc +++ b/README.rdoc @@ -437,34 +437,38 @@ typically don't have to +use+ them explicitly. == Testing -The Sinatra::Test mixin and Sinatra::TestHarness class include a variety of -helper methods for testing your Sinatra app: +Sinatra tests can be written using any Rack-based testing library +or framework. {Rack::Test}[http://gitrdoc.com/brynary/rack-test] is +recommended: require 'my_sinatra_app' - require 'test/unit' - require 'sinatra/test' + require 'rack/test' class MyAppTest < Test::Unit::TestCase - include Sinatra::Test + include Rack::Test::Methods + + def app + Sinatra::Application + end def test_my_default get '/' - assert_equal 'Hello World!', @response.body + assert_equal 'Hello World!', last_response.body end def test_with_params - get '/meet', {:name => 'Frank'} - assert_equal 'Hello Frank!', @response.body + get '/meet', :name => 'Frank' + assert_equal 'Hello Frank!', last_response.body end def test_with_rack_env - get '/', {}, :agent => 'Songbird' - assert_equal "You're using Songbird!", @response.body + get '/', {}, 'HTTP_USER_AGENT' => 'Songbird' + assert_equal "You're using Songbird!", last_response.body end end -See http://www.sinatrarb.com/testing.html for more on Sinatra::Test and using it -with other test frameworks such as RSpec, Bacon, and test/spec. +NOTE: The built-in Sinatra::Test module and Sinatra::TestHarness class +are deprecated as of the 0.9.2 release. == Command line