padrino-core 0.12.4 → 0.12.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/padrino-core/application.rb +2 -1
- data/lib/padrino-core/application/routing.rb +1 -1
- data/lib/padrino-core/loader.rb +1 -0
- data/lib/padrino-core/version.rb +1 -1
- data/padrino-core.gemspec +2 -0
- data/test/test_application.rb +19 -0
- data/test/test_params_protection.rb +12 -0
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4fabe3c04b7784dac19fe6673af74663794e3477
|
4
|
+
data.tar.gz: 73e8310a4d9f5a9207ed8f19379c492135c28e00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d3814cb0118bfdbd1c358b1a0da1e4b66a3a5336ed11316489a43a968cf45821cde9d04708932e25d3d396885b693fd0d4ce60564a82bd5bce9748f3d20c61f
|
7
|
+
data.tar.gz: 08a08b2236f7b41cfabc97bcb0273ec8a4036e99058f137ee0c56b9efb78ae63f52e7cfd3fbcf5237de7dbbbe48341352c0dbdd548c8f4b90ed4c3e695eb5d05
|
@@ -43,9 +43,10 @@ module Padrino
|
|
43
43
|
def inherited(base)
|
44
44
|
begun_at = Time.now
|
45
45
|
CALLERS_TO_IGNORE.concat(PADRINO_IGNORE_CALLERS)
|
46
|
+
super(base)
|
47
|
+
base.prerequisites.replace(self.prerequisites.dup)
|
46
48
|
base.default_configuration!
|
47
49
|
logger.devel :setup, begun_at, base
|
48
|
-
super(base)
|
49
50
|
end
|
50
51
|
|
51
52
|
##
|
@@ -567,7 +567,7 @@ module Padrino
|
|
567
567
|
options.delete(:params)
|
568
568
|
elsif options.include?(:params)
|
569
569
|
options[:params] ||= []
|
570
|
-
options[:params]
|
570
|
+
options[:params] |= Array(options[:with]) if options[:with]
|
571
571
|
end
|
572
572
|
|
573
573
|
# We need check if path is a symbol, if that it's a named route.
|
data/lib/padrino-core/loader.rb
CHANGED
data/lib/padrino-core/version.rb
CHANGED
data/padrino-core.gemspec
CHANGED
@@ -27,6 +27,8 @@ Gem::Specification.new do |s|
|
|
27
27
|
if ENV["SINATRA_EDGE"]
|
28
28
|
s.add_dependency("sinatra")
|
29
29
|
else
|
30
|
+
# remove this rack dependency after Sinatra > 1.4.5
|
31
|
+
s.add_dependency("rack", "< 1.6.0")
|
30
32
|
s.add_dependency("sinatra", "~> 1.4.2")
|
31
33
|
end
|
32
34
|
s.add_dependency("http_router", "~> 0.11.0")
|
data/test/test_application.rb
CHANGED
@@ -65,6 +65,13 @@ describe "Application" do
|
|
65
65
|
assert_equal 'shared', body
|
66
66
|
end
|
67
67
|
|
68
|
+
it 'should be able to execute the register keyword inside the configure_apps block' do
|
69
|
+
Asdf = Module.new
|
70
|
+
Padrino.configure_apps { register Asdf }
|
71
|
+
class GodFather < Padrino::Application; end
|
72
|
+
assert_includes GodFather.extensions, Asdf
|
73
|
+
end
|
74
|
+
|
68
75
|
it 'should able to set custome session management' do
|
69
76
|
class PadrinoTestApp3 < Padrino::Application
|
70
77
|
set :sessions, :use => Rack::Session::Pool
|
@@ -142,5 +149,17 @@ describe "Application" do
|
|
142
149
|
assert_equal 'custom error', body
|
143
150
|
end
|
144
151
|
end
|
152
|
+
|
153
|
+
describe 'global prerequisites' do
|
154
|
+
after do
|
155
|
+
Padrino::Application.prerequisites.clear
|
156
|
+
end
|
157
|
+
|
158
|
+
it 'should be inherited by children of Padrino::Application' do
|
159
|
+
Padrino::Application.prerequisites << 'my_prerequisites'
|
160
|
+
class InheritanceTest < Padrino::Application; end
|
161
|
+
assert_includes InheritanceTest.prerequisites, 'my_prerequisites'
|
162
|
+
end
|
163
|
+
end
|
145
164
|
end # application functionality
|
146
165
|
end
|
@@ -75,6 +75,18 @@ describe "Padrino::ParamsProtection" do
|
|
75
75
|
assert_equal({ 'name' => @jack['name'], 'id' => '24', 'tag' => '42' }, result)
|
76
76
|
end
|
77
77
|
|
78
|
+
it 'should not fail if :with is not an Array' do
|
79
|
+
result = nil
|
80
|
+
mock_app do
|
81
|
+
post :basic, :with => :id, :params => [ :id ] do
|
82
|
+
result = params
|
83
|
+
''
|
84
|
+
end
|
85
|
+
end
|
86
|
+
post '/basic/24?' + @jack.to_query
|
87
|
+
assert_equal({ 'id' => '24' }, result)
|
88
|
+
end
|
89
|
+
|
78
90
|
it 'should understand true or false values' do
|
79
91
|
result = nil
|
80
92
|
mock_app do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: padrino-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Padrino Team
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2015-03-04 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: padrino-support
|
@@ -19,14 +19,28 @@ dependencies:
|
|
19
19
|
requirements:
|
20
20
|
- - '='
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.12.
|
22
|
+
version: 0.12.5
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - '='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.12.
|
29
|
+
version: 0.12.5
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rack
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - <
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 1.6.0
|
37
|
+
type: :runtime
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - <
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.6.0
|
30
44
|
- !ruby/object:Gem::Dependency
|
31
45
|
name: sinatra
|
32
46
|
requirement: !ruby/object:Gem::Requirement
|