Fix ruby warnings

Cleans up all warnings generated from Sinatra. There's still
a bunch of warnings coming from HAML, though. It would be nice
if we could use Kernel#warn for deprecation notices but that's
going to be annoying if there's a bunch of unrelated warnings
from other libs.
This commit is contained in:
Ryan Tomayko 2009-01-09 01:49:49 -08:00
parent a4a1ecf233
commit 49c60151bf
4 changed files with 7 additions and 5 deletions

View File

@ -70,7 +70,7 @@ module Sinatra
def redirect(uri, *args)
status 302
response['Location'] = uri
halt *args
halt(*args)
end
# Halt processing and return the error status provided.
@ -476,7 +476,7 @@ module Sinatra
s !~ /\(.*\)/ }
file = line.sub(/:\d+.*$/, '')
if data = ::IO.read(file).split('__END__')[1]
data.gsub! /\r\n/, "\n"
data.gsub!(/\r\n/, "\n")
template = nil
data.each_line do |line|
if line =~ /^@@\s*(.*)/

View File

@ -10,6 +10,8 @@ module Sinatra::Test
@app = Sinatra.new(base, &block)
end
undef request if method_defined?(:request)
def request(verb, path, *args)
fail "@app not set - cannot make request" if @app.nil?
@request = Rack::MockRequest.new(@app)

View File

@ -49,7 +49,7 @@ describe 'Sinatra::Base' do
it 'can take multiple definitions of a route' do
app = mock_app {
user_agent /Foo/
user_agent(/Foo/)
get '/foo' do
'foo'
end

View File

@ -278,7 +278,7 @@ describe "Routing" do
it "passes to the next route when user_agent does not match" do
mock_app {
user_agent /Foo/
user_agent(/Foo/)
get '/foo' do
'Hello World'
end
@ -293,7 +293,7 @@ describe "Routing" do
it "makes captures in user agent pattern available in params[:agent]" do
mock_app {
user_agent /Foo (.*)/
user_agent(/Foo (.*)/)
get '/foo' do
'Hello ' + params[:agent].first
end