sinatra 1.4.8 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sinatra might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +111 -47
- data/CONTRIBUTING.md +1 -1
- data/Gemfile +41 -49
- data/LICENSE +4 -1
- data/MAINTENANCE.md +42 -0
- data/README.de.md +644 -436
- data/README.es.md +6 -6
- data/README.fr.md +9 -9
- data/README.hu.md +37 -3
- data/README.ja.md +103 -45
- data/README.ko.md +8 -8
- data/README.md +471 -363
- data/README.pt-br.md +3 -3
- data/README.pt-pt.md +2 -2
- data/README.ru.md +42 -64
- data/README.zh.md +8 -8
- data/Rakefile +72 -49
- data/SECURITY.md +35 -0
- data/lib/sinatra/base.rb +137 -195
- data/lib/sinatra/indifferent_hash.rb +150 -0
- data/lib/sinatra/main.rb +1 -0
- data/lib/sinatra/show_exceptions.rb +63 -55
- data/lib/sinatra/version.rb +1 -1
- data/sinatra.gemspec +19 -7
- metadata +30 -164
- data/lib/sinatra/ext.rb +0 -17
- data/test/asciidoctor_test.rb +0 -72
- data/test/base_test.rb +0 -167
- data/test/builder_test.rb +0 -91
- data/test/coffee_test.rb +0 -96
- data/test/compile_test.rb +0 -183
- data/test/contest.rb +0 -91
- data/test/creole_test.rb +0 -65
- data/test/delegator_test.rb +0 -160
- data/test/encoding_test.rb +0 -20
- data/test/erb_test.rb +0 -116
- data/test/extensions_test.rb +0 -98
- data/test/filter_test.rb +0 -487
- data/test/haml_test.rb +0 -109
- data/test/helper.rb +0 -132
- data/test/helpers_test.rb +0 -1917
- data/test/integration/app.rb +0 -79
- data/test/integration_helper.rb +0 -236
- data/test/integration_test.rb +0 -104
- data/test/less_test.rb +0 -69
- data/test/liquid_test.rb +0 -77
- data/test/mapped_error_test.rb +0 -285
- data/test/markaby_test.rb +0 -80
- data/test/markdown_test.rb +0 -85
- data/test/mediawiki_test.rb +0 -68
- data/test/middleware_test.rb +0 -68
- data/test/nokogiri_test.rb +0 -67
- data/test/public/favicon.ico +0 -0
- data/test/public/hello+world.txt +0 -1
- data/test/rabl_test.rb +0 -89
- data/test/rack_test.rb +0 -45
- data/test/radius_test.rb +0 -59
- data/test/rdoc_test.rb +0 -66
- data/test/readme_test.rb +0 -130
- data/test/request_test.rb +0 -100
- data/test/response_test.rb +0 -63
- data/test/result_test.rb +0 -76
- data/test/route_added_hook_test.rb +0 -59
- data/test/routing_test.rb +0 -1456
- data/test/sass_test.rb +0 -115
- data/test/scss_test.rb +0 -88
- data/test/server_test.rb +0 -56
- data/test/settings_test.rb +0 -582
- data/test/sinatra_test.rb +0 -12
- data/test/slim_test.rb +0 -102
- data/test/static_test.rb +0 -266
- data/test/streaming_test.rb +0 -149
- data/test/stylus_test.rb +0 -90
- data/test/templates_test.rb +0 -382
- data/test/textile_test.rb +0 -65
- data/test/views/a/in_a.str +0 -1
- data/test/views/ascii.erb +0 -2
- data/test/views/b/in_b.str +0 -1
- data/test/views/calc.html.erb +0 -1
- data/test/views/error.builder +0 -3
- data/test/views/error.erb +0 -3
- data/test/views/error.haml +0 -3
- data/test/views/error.sass +0 -2
- data/test/views/explicitly_nested.str +0 -1
- data/test/views/foo/hello.test +0 -1
- data/test/views/hello.asciidoc +0 -1
- data/test/views/hello.builder +0 -1
- data/test/views/hello.coffee +0 -1
- data/test/views/hello.creole +0 -1
- data/test/views/hello.erb +0 -1
- data/test/views/hello.haml +0 -1
- data/test/views/hello.less +0 -5
- data/test/views/hello.liquid +0 -1
- data/test/views/hello.mab +0 -1
- data/test/views/hello.md +0 -1
- data/test/views/hello.mediawiki +0 -1
- data/test/views/hello.nokogiri +0 -1
- data/test/views/hello.rabl +0 -2
- data/test/views/hello.radius +0 -1
- data/test/views/hello.rdoc +0 -1
- data/test/views/hello.sass +0 -2
- data/test/views/hello.scss +0 -3
- data/test/views/hello.slim +0 -1
- data/test/views/hello.str +0 -1
- data/test/views/hello.styl +0 -2
- data/test/views/hello.test +0 -1
- data/test/views/hello.textile +0 -1
- data/test/views/hello.wlang +0 -1
- data/test/views/hello.yajl +0 -1
- data/test/views/layout2.builder +0 -3
- data/test/views/layout2.erb +0 -2
- data/test/views/layout2.haml +0 -2
- data/test/views/layout2.liquid +0 -2
- data/test/views/layout2.mab +0 -2
- data/test/views/layout2.nokogiri +0 -3
- data/test/views/layout2.rabl +0 -3
- data/test/views/layout2.radius +0 -2
- data/test/views/layout2.slim +0 -3
- data/test/views/layout2.str +0 -2
- data/test/views/layout2.test +0 -1
- data/test/views/layout2.wlang +0 -2
- data/test/views/nested.str +0 -1
- data/test/views/utf8.erb +0 -2
- data/test/wlang_test.rb +0 -87
- data/test/yajl_test.rb +0 -86
data/test/helper.rb
DELETED
@@ -1,132 +0,0 @@
|
|
1
|
-
ENV['RACK_ENV'] = 'test'
|
2
|
-
Encoding.default_external = "UTF-8" if defined? Encoding
|
3
|
-
|
4
|
-
RUBY_ENGINE = 'ruby' unless defined? RUBY_ENGINE
|
5
|
-
|
6
|
-
begin
|
7
|
-
require 'rack'
|
8
|
-
rescue LoadError
|
9
|
-
require 'rubygems'
|
10
|
-
require 'rack'
|
11
|
-
end
|
12
|
-
|
13
|
-
testdir = File.dirname(__FILE__)
|
14
|
-
$LOAD_PATH.unshift testdir unless $LOAD_PATH.include?(testdir)
|
15
|
-
|
16
|
-
libdir = File.dirname(File.dirname(__FILE__)) + '/lib'
|
17
|
-
$LOAD_PATH.unshift libdir unless $LOAD_PATH.include?(libdir)
|
18
|
-
|
19
|
-
require 'minitest'
|
20
|
-
require 'contest'
|
21
|
-
require 'rack/test'
|
22
|
-
require 'sinatra/base'
|
23
|
-
|
24
|
-
class Sinatra::Base
|
25
|
-
include Minitest::Assertions
|
26
|
-
# Allow assertions in request context
|
27
|
-
def assertions
|
28
|
-
@assertions ||= 0
|
29
|
-
end
|
30
|
-
|
31
|
-
attr_writer :assertions
|
32
|
-
end
|
33
|
-
|
34
|
-
class Rack::Builder
|
35
|
-
def include?(middleware)
|
36
|
-
@ins.any? { |m| p m ; middleware === m }
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
Sinatra::Base.set :environment, :test
|
41
|
-
|
42
|
-
class Minitest::Test
|
43
|
-
include Rack::Test::Methods
|
44
|
-
|
45
|
-
class << self
|
46
|
-
alias_method :it, :test
|
47
|
-
alias_method :section, :context
|
48
|
-
end
|
49
|
-
|
50
|
-
def self.example(desc = nil, &block)
|
51
|
-
@example_count = 0 unless instance_variable_defined? :@example_count
|
52
|
-
@example_count += 1
|
53
|
-
it(desc || "Example #{@example_count}", &block)
|
54
|
-
end
|
55
|
-
|
56
|
-
alias_method :response, :last_response
|
57
|
-
|
58
|
-
setup do
|
59
|
-
Sinatra::Base.set :environment, :test
|
60
|
-
end
|
61
|
-
|
62
|
-
# Sets up a Sinatra::Base subclass defined with the block
|
63
|
-
# given. Used in setup or individual spec methods to establish
|
64
|
-
# the application.
|
65
|
-
def mock_app(base=Sinatra::Base, &block)
|
66
|
-
@app = Sinatra.new(base, &block)
|
67
|
-
end
|
68
|
-
|
69
|
-
def app
|
70
|
-
Rack::Lint.new(@app)
|
71
|
-
end
|
72
|
-
|
73
|
-
def body
|
74
|
-
response.body.to_s
|
75
|
-
end
|
76
|
-
|
77
|
-
def assert_body(value)
|
78
|
-
if value.respond_to? :to_str
|
79
|
-
assert_equal value.lstrip.gsub(/\s*\n\s*/, ""), body.lstrip.gsub(/\s*\n\s*/, "")
|
80
|
-
else
|
81
|
-
assert_match value, body
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
def assert_status(expected)
|
86
|
-
assert_equal Integer(expected), Integer(status)
|
87
|
-
end
|
88
|
-
|
89
|
-
def assert_like(a,b)
|
90
|
-
pattern = /id=['"][^"']*["']|\s+/
|
91
|
-
assert_equal a.strip.gsub(pattern, ""), b.strip.gsub(pattern, "")
|
92
|
-
end
|
93
|
-
|
94
|
-
def assert_include(str, substr)
|
95
|
-
assert str.include?(substr), "expected #{str.inspect} to include #{substr.inspect}"
|
96
|
-
end
|
97
|
-
|
98
|
-
def options(uri, params = {}, env = {}, &block)
|
99
|
-
request(uri, env.merge(:method => "OPTIONS", :params => params), &block)
|
100
|
-
end
|
101
|
-
|
102
|
-
def patch(uri, params = {}, env = {}, &block)
|
103
|
-
request(uri, env.merge(:method => "PATCH", :params => params), &block)
|
104
|
-
end
|
105
|
-
|
106
|
-
def link(uri, params = {}, env = {}, &block)
|
107
|
-
request(uri, env.merge(:method => "LINK", :params => params), &block)
|
108
|
-
end
|
109
|
-
|
110
|
-
def unlink(uri, params = {}, env = {}, &block)
|
111
|
-
request(uri, env.merge(:method => "UNLINK", :params => params), &block)
|
112
|
-
end
|
113
|
-
|
114
|
-
# Delegate other missing methods to response.
|
115
|
-
def method_missing(name, *args, &block)
|
116
|
-
if response && response.respond_to?(name)
|
117
|
-
response.send(name, *args, &block)
|
118
|
-
else
|
119
|
-
super
|
120
|
-
end
|
121
|
-
rescue Rack::Test::Error
|
122
|
-
super
|
123
|
-
end
|
124
|
-
|
125
|
-
# Do not output warnings for the duration of the block.
|
126
|
-
def silence_warnings
|
127
|
-
$VERBOSE, v = nil, $VERBOSE
|
128
|
-
yield
|
129
|
-
ensure
|
130
|
-
$VERBOSE = v
|
131
|
-
end
|
132
|
-
end
|