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:
parent
a4a1ecf233
commit
49c60151bf
|
@ -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*(.*)/
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue