Permalink
Browse files

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
  • Loading branch information...
1 parent f4d4a93 commit 1d9034ff8086fc5e9c5ed61658cef4c950d32e4f @rkh rkh committed Mar 12, 2011
Showing with 4 additions and 4 deletions.
  1. +1 −1 test/base_test.rb
  2. +1 −1 test/request_test.rb
  3. +1 −1 test/settings_test.rb
  4. +1 −1 test/sinatra_test.rb
View
@@ -71,7 +71,7 @@ class TestMiddleware < Sinatra::Base
end
it 'exposes the downstream app' do
- middleware = TestMiddleware.new(app)
+ middleware = TestMiddleware.new!(app)
assert_same app, middleware.app
end
View
@@ -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
@@ -112,7 +112,7 @@ def foo=(value)
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
@@ -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

0 comments on commit 1d9034f

Please sign in to comment.