Skip to content

Instantly share code, notes, and snippets.

@kematzy
Created June 24, 2009 17:07
Show Gist options
  • Save kematzy/135388 to your computer and use it in GitHub Desktop.
Save kematzy/135388 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'spec'
require 'spec/interop/test'
# require 'test/spec'
require 'sinatra/base'
require 'rack/test'
class Dummy < Sinatra::Base
set :public, 'public'
set :views, 'views'
get '/' do
"hello world"
end
end
class Test::Unit::TestCase
include Rack::Test::Methods
def app
Dummy.new
end
### NB!!! ############
# Commenting / Uncommenting this method will show the error
#
# def setup
# Sinatra::Base.set :environment, :test
# end
end
describe "Dummy" do
it "should return hello world from the / (this works in both cases)" do
get '/'
assert_equal('hello world', last_response.body)
end
it "should NOT return a Sinatra::ShowExceptions object" do
assert_no_match(/Sinatra::ShowExceptions/, app.inspect )
end
it "should be a Dummy class" do
assert_equal(Dummy, app.class )
end
end #/ Dummy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment