hobbit-contrib 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hobbit/contrib/version.rb +1 -1
- data/lib/hobbit/filter.rb +4 -2
- data/spec/filter_spec.rb +28 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38cbd1cc4eec48457c5c880ef48dd29617c40c7c
|
4
|
+
data.tar.gz: 590f088b6fad3a60d927c12d7274c1b3c332a959
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b394910413b48d9b4525ccb4d5cd63244b65209bfddb81e1e7f5a1fad218ee95e52d5894e14ec678be72eadd5129ac45d0b0e5073dafd0e7499132355697de5e
|
7
|
+
data.tar.gz: 8e6217e2811ea0772730a19e5fa03aa7a1af871201ae97a5bdd7751f81a2dcad5ce1b7807ae6d1491e781fe47d2c2852da95b2e83ecac06b17eaa76b3026ecbe
|
data/lib/hobbit/filter.rb
CHANGED
data/spec/filter_spec.rb
CHANGED
@@ -142,4 +142,32 @@ EOS
|
|
142
142
|
last_request.env['hobbit.after'].must_equal 'this will match'
|
143
143
|
end
|
144
144
|
end
|
145
|
+
|
146
|
+
describe 'when a before filter redirects the response' do
|
147
|
+
let :app do
|
148
|
+
mock_app do
|
149
|
+
include Hobbit::Filter
|
150
|
+
|
151
|
+
before do
|
152
|
+
response.redirect '/goodbye' unless request.path_info == '/goodbye'
|
153
|
+
end
|
154
|
+
|
155
|
+
get '/' do
|
156
|
+
'hello world'
|
157
|
+
end
|
158
|
+
|
159
|
+
get '/goodbye' do
|
160
|
+
'goodbye world'
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
it 'must redirect on before filters' do
|
166
|
+
get '/'
|
167
|
+
last_response.must_be :redirection?
|
168
|
+
follow_redirect!
|
169
|
+
last_response.must_be :ok?
|
170
|
+
last_response.body.must_match /goodbye world/
|
171
|
+
end
|
172
|
+
end
|
145
173
|
end
|