fixed Irb errors
This commit is contained in:
parent
436f1fd14a
commit
1de67c2d6c
|
@ -26,7 +26,7 @@ module Sinatra
|
|||
status 404
|
||||
views_dir SINATRA_ROOT + '/files'
|
||||
|
||||
if request.path_info == '/'
|
||||
if request.path_info == '/' && request.request_method == 'GET'
|
||||
erb :default_index
|
||||
else
|
||||
erb :not_found
|
||||
|
|
|
@ -4,8 +4,6 @@ module Sinatra
|
|||
|
||||
module TestMethods
|
||||
|
||||
@response = nil unless defined?("@response")
|
||||
|
||||
%w(get post put delete).each do |verb|
|
||||
module_eval <<-end_eval
|
||||
def #{verb}_it(path, params = {})
|
||||
|
@ -17,22 +15,22 @@ module Sinatra
|
|||
end
|
||||
|
||||
def response
|
||||
@response
|
||||
@response || Rack::MockResponse.new(404, {}, '')
|
||||
end
|
||||
|
||||
def status
|
||||
@response.status
|
||||
response.status
|
||||
end
|
||||
|
||||
def text
|
||||
@response.body
|
||||
response.body
|
||||
end
|
||||
alias :xml :text
|
||||
alias :html :text
|
||||
alias :body :text
|
||||
|
||||
def headers
|
||||
@response.headers
|
||||
response.headers
|
||||
end
|
||||
|
||||
private
|
||||
|
|
Loading…
Reference in New Issue