Permalink
Browse files

Recommend Rack::Test in README / note Sinatra::Test deprecation

  • Loading branch information...
1 parent b48ed22 commit c831278af96ec4d8d0b0b2cdd045399f50fbfb0f @rtomayko rtomayko committed May 18, 2009
Showing with 16 additions and 12 deletions.
  1. +16 −12 README.rdoc
View
@@ -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

0 comments on commit c831278

Please sign in to comment.