strong_routes 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/strong_routes/allow.rb +7 -1
- data/lib/strong_routes/version.rb +1 -1
- data/spec/strong_routes/allow_spec.rb +4 -4
- metadata +20 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb6ccd8355f108b1f20a7b360fcd1e7338787eb5
|
4
|
+
data.tar.gz: a48b69732cafb969a2c804d53ff71b8fc207c346
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 869ab0a9f88bac63c1f4cb725882968ccf4c609832e4221f794c928fce6682f08e80efafdd5e3ca373dd37331c2d942451314da94b0e371767f2ffc37f3f3279
|
7
|
+
data.tar.gz: 9a438c8125148f290549a4426b08287f710789b72ac7748b2d8c2ea862a1ac390933f1aabf6145276570fb943f132c2d8eac112fedd8ad928584ffd5ccc5d1d1
|
data/lib/strong_routes/allow.rb
CHANGED
@@ -5,7 +5,7 @@ module StrongRoutes
|
|
5
5
|
@options = options
|
6
6
|
end
|
7
7
|
|
8
|
-
def
|
8
|
+
def _call(env)
|
9
9
|
return @app.call(env) unless enabled?
|
10
10
|
|
11
11
|
request = ::Rack::Request.new(env)
|
@@ -17,6 +17,12 @@ module StrongRoutes
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
+
# HACK: This makes this middleware threadsafe, but is not a very good pattern.
|
21
|
+
# We should rewrite this to use a separate class with instance-level stuff.
|
22
|
+
def call(env)
|
23
|
+
dup._call(env)
|
24
|
+
end
|
25
|
+
|
20
26
|
private
|
21
27
|
|
22
28
|
def allowed_routes
|
@@ -5,8 +5,8 @@ def middleware
|
|
5
5
|
end
|
6
6
|
|
7
7
|
describe ::StrongRoutes::Allow do
|
8
|
-
let(:app) { middleware.new(
|
9
|
-
let(:
|
8
|
+
let(:app) { middleware.new(stack) }
|
9
|
+
let(:stack) { lambda { |env| [ 200, { "Content-Type" => "text/plain" }, [ "Good" ] ] } }
|
10
10
|
|
11
11
|
context "without allowed routes set" do
|
12
12
|
it "does not allow access to /users" do
|
@@ -63,7 +63,7 @@ describe ::StrongRoutes::Allow do
|
|
63
63
|
end
|
64
64
|
|
65
65
|
context "enabled option is false" do
|
66
|
-
let(:app) { middleware.new(
|
66
|
+
let(:app) { middleware.new(stack, { :enabled => false }) }
|
67
67
|
|
68
68
|
it "passes request to the next app" do
|
69
69
|
get "/users/profile/anything?stuff=12"
|
@@ -72,7 +72,7 @@ describe ::StrongRoutes::Allow do
|
|
72
72
|
end
|
73
73
|
|
74
74
|
context "allowed_routes passed to initializer" do
|
75
|
-
let(:app) { middleware.new(
|
75
|
+
let(:app) { middleware.new(stack, { :allowed_routes => [ :users ] }) }
|
76
76
|
|
77
77
|
it "allows /users with :users" do
|
78
78
|
get "/users"
|
metadata
CHANGED
@@ -1,111 +1,111 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: strong_routes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Hutchison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: actionpack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 3.2.0
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 3.2.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: pry-nav
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rack-test
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: simplecov
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
description: Middleware to reject/allow requests before allocating a database connection
|
@@ -116,7 +116,7 @@ executables: []
|
|
116
116
|
extensions: []
|
117
117
|
extra_rdoc_files: []
|
118
118
|
files:
|
119
|
-
- .gitignore
|
119
|
+
- ".gitignore"
|
120
120
|
- Gemfile
|
121
121
|
- LICENSE.txt
|
122
122
|
- README.md
|
@@ -145,17 +145,17 @@ require_paths:
|
|
145
145
|
- lib
|
146
146
|
required_ruby_version: !ruby/object:Gem::Requirement
|
147
147
|
requirements:
|
148
|
-
- -
|
148
|
+
- - ">="
|
149
149
|
- !ruby/object:Gem::Version
|
150
150
|
version: '0'
|
151
151
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
152
|
requirements:
|
153
|
-
- -
|
153
|
+
- - ">="
|
154
154
|
- !ruby/object:Gem::Version
|
155
155
|
version: '0'
|
156
156
|
requirements: []
|
157
157
|
rubyforge_project:
|
158
|
-
rubygems_version: 2.
|
158
|
+
rubygems_version: 2.5.1
|
159
159
|
signing_key:
|
160
160
|
specification_version: 4
|
161
161
|
summary: Middleware to reject/allow requests before allocating a database connection
|