Permalink
Browse files

Less warnings to sate zenspider's needs

  • Loading branch information...
1 parent 452a030 commit da37a883955144b027561034757088a385d51e31 @halorgium halorgium committed with rtomayko May 17, 2009
Showing with 21 additions and 6 deletions.
  1. +3 −3 lib/sinatra/base.rb
  2. +6 −1 test/base_test.rb
  3. +4 −2 test/contest.rb
  4. +4 −0 test/helpers_test.rb
  5. +4 −0 test/mapped_error_test.rb
View
@@ -302,7 +302,7 @@ def lookup_layout(engine, template, views_dir)
end
def render_erb(template, data, options, locals, &block)
- original_out_buf = @_out_buf
+ original_out_buf = defined?(@_out_buf) && @_out_buf
data = data.call if data.kind_of? Proc
instance = ::ERB.new(data, nil, nil, '@_out_buf')
@@ -821,7 +821,7 @@ def compile(path)
# in `extensions` available to the handlers and templates
def helpers(*extensions, &block)
class_eval(&block) if block_given?
- include *extensions if extensions.any?
+ include(*extensions) if extensions.any?
end
def extensions
@@ -1055,7 +1055,7 @@ class Default < Base
def self.register(*extensions, &block) #:nodoc:
added_methods = extensions.map {|m| m.public_instance_methods }.flatten
- Delegator.delegate *added_methods
+ Delegator.delegate(*added_methods)
super(*extensions, &block)
end
end
View
@@ -1,6 +1,10 @@
require File.dirname(__FILE__) + '/helper'
class BaseTest < Test::Unit::TestCase
+ def test_default
+ assert true
+ end
+
describe 'Sinatra::Base subclasses' do
class TestApp < Sinatra::Base
get '/' do
@@ -23,6 +27,7 @@ class TestApp < Sinatra::Base
class TestApp < Sinatra::Base
get '/state' do
+ @foo ||= "new"
body = "Foo: #{@foo}"
@foo = 'discard'
body
@@ -34,7 +39,7 @@ class TestApp < Sinatra::Base
2.times do
response = request.get('/state')
assert response.ok?
- assert_equal 'Foo: ', response.body
+ assert_equal 'Foo: new', response.body
end
end
View
@@ -6,8 +6,10 @@
# allow them. Having a failure when no tests have been defined seems
# counter-intuitive.
class Test::Unit::TestSuite
- def empty?
- false
+ unless method_defined?(:empty?)
+ def empty?
+ false
+ end
end
end
View
@@ -1,6 +1,10 @@
require File.dirname(__FILE__) + '/helper'
class HelpersTest < Test::Unit::TestCase
+ def test_default
+ assert true
+ end
+
describe 'status' do
setup do
mock_app {
@@ -7,6 +7,10 @@ class FooNotFound < Sinatra::NotFound
end
class MappedErrorTest < Test::Unit::TestCase
+ def test_default
+ assert true
+ end
+
describe 'Exception Mappings' do
it 'invokes handlers registered with ::error when raised' do
mock_app {

0 comments on commit da37a88

Please sign in to comment.