Deprecate get_it, post_it, etc. test helpers with warnings
This commit is contained in:
parent
1fb5b99dca
commit
91922b78a7
4
CHANGES
4
CHANGES
|
@ -68,6 +68,10 @@
|
|||
treated as internal server errors and result in a 500 response
|
||||
status.
|
||||
|
||||
* Deprecated the "get_it", "post_it", "put_it", "delete_it", and "head_it"
|
||||
test helper methods. Use "get", "post", "put", "delete", and "head",
|
||||
respectively, instead.
|
||||
|
||||
* Removed Event and EventContext classes. Applications are defined in a
|
||||
subclass of Sinatra::Base; each request is processed within an
|
||||
instance.
|
||||
|
|
|
@ -85,13 +85,19 @@ module Sinatra
|
|||
if defined? Sinatra::Compat
|
||||
# Deprecated. Use: "get" instead of "get_it".
|
||||
%w(get head post put delete).each do |verb|
|
||||
alias_method "#{verb}_it", verb
|
||||
eval <<-RUBY, binding, __FILE__, __LINE__
|
||||
def #{verb}_it(*args, &block)
|
||||
sinatra_warn "The #{verb}_it method is deprecated; use #{verb} instead."
|
||||
test_request('#{verb.upcase}', *args, &block)
|
||||
end
|
||||
RUBY
|
||||
end
|
||||
|
||||
# Deprecated. Tests no longer delegate missing methods to the
|
||||
# mock response. Use: @response
|
||||
def method_missing(name, *args, &block)
|
||||
if @response && @response.respond_to?(name)
|
||||
sinatra_warn "The #{name} method is deprecated; use @response.#{name} instead."
|
||||
@response.send(name, *args, &block)
|
||||
else
|
||||
super
|
||||
|
|
Loading…
Reference in New Issue