Bacon support

This commit is contained in:
Dylan Egan 2009-01-09 17:37:26 +11:00 committed by Ryan Tomayko
parent c00a25ee41
commit 1fb5b99dca
3 changed files with 36 additions and 2 deletions

View File

@ -41,6 +41,9 @@
has the status code specified. It's also possible to register an error
page for a range of status codes: "error(500..599)".
* Added support for Bacon (test framework). The 'sinatra/test/bacon' file
can be required to setup Sinatra test helpers on Bacon::Context.
* Deprecated "set_option" and "set_options"; use "set" instead.
* Deprecated the "env" option ("options.env"); use "environment" instead.

View File

@ -443,8 +443,22 @@ your app:
end
See Sinatra::Test::Methods for more information on +get_it+, +post_it+,
+put_it+, and friends.
=== Bacon
require 'sinatra'
require 'sinatra/test/bacon'
require 'my_sinatra_app'
describe 'My app' do
it 'should be ok' do
get '/'
should.be.ok
body.should == 'Im OK'
end
end
See Sinatra::Test for more information on +get+, +post+, +put+, and
friends.
== Command line

17
lib/sinatra/test/bacon.rb Normal file
View File

@ -0,0 +1,17 @@
require 'bacon'
require 'sinatra/test'
Sinatra::Default.set(
:env => :test,
:run => false,
:raise_errors => true,
:logging => false
)
module Sinatra::Test
def should
@response.should
end
end
Bacon::Context.send(:include, Sinatra::Test)