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:
parent
f4d4a93c04
commit
1d9034ff80
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue