use new! rather than new for tests testing instance method

that way we ensure not to have any middleware in front of the Sinatra instance
This commit is contained in:
Konstantin Haase 2011-03-12 15:52:43 +01:00
parent f4d4a93c04
commit 1d9034ff80
4 changed files with 4 additions and 4 deletions

View File

@ -71,7 +71,7 @@ class BaseTest < Test::Unit::TestCase
end
it 'exposes the downstream app' do
middleware = TestMiddleware.new(app)
middleware = TestMiddleware.new!(app)
assert_same app, middleware.app
end

View File

@ -38,7 +38,7 @@ class RequestTest < Test::Unit::TestCase
'CONTENT_TYPE' => 'application/x-www-form-urlencoded',
'rack.input' => StringIO.new('foo=bar')
)
params = Sinatra::Base.new.send(:indifferent_hash).replace(request.params)
params = Sinatra::Base.new!.send(:indifferent_hash).replace(request.params)
dumped = Marshal.dump(request.params)
assert_equal 'bar', Marshal.load(dumped)['foo']
end

View File

@ -112,7 +112,7 @@ class SettingsTest < Test::Unit::TestCase
end
it 'is accessible from instances via #settings' do
assert_equal :foo, @base.new.settings.environment
assert_equal :foo, @base.new!.settings.environment
end
it 'is accessible from class via #settings' do

View File

@ -12,6 +12,6 @@ class SinatraTest < Test::Unit::TestCase
end
it "responds to #template_cache" do
assert_kind_of Tilt::Cache, Sinatra::Base.new.template_cache
assert_kind_of Tilt::Cache, Sinatra::Base.new!.template_cache
end
end