mustermann19 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mustermann/grape.rb +1 -1
- data/lib/mustermann/version.rb +1 -1
- data/spec/grape_spec.rb +30 -30
- 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: 0213dc6d9a2c7638cac33790888dfaaa7da56258
|
4
|
+
data.tar.gz: 2c5628b7ce6f0d6c83693f714de0b6b634a411c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4adbeefe8e9c58a9478dbe235029d55234aba29c70bea436b9ae8bdf1a1f03c031fb80ec92bf2d6ad7401ee4180b9ea3d690b4554032ee6e14644066661976da
|
7
|
+
data.tar.gz: 95c9a1d24af3a7823469cc04bb22fda9a3232723d0c7b3a6f7cbf6cb1dfd0d588b6f5138e3e035413a1636b421d190f5faa43d5f396632462c9c70c921de0bdd
|
data/lib/mustermann/grape.rb
CHANGED
@@ -14,7 +14,7 @@ module Mustermann
|
|
14
14
|
on(nil, ??, ?)) { |c| unexpected(c) }
|
15
15
|
|
16
16
|
on(?*) { |c| scan(/\w+/) ? node(:named_splat, buffer.matched) : node(:splat) }
|
17
|
-
on(?:) { |c| node(:capture) { scan(/\w+/) } }
|
17
|
+
on(?:) { |c| node(:capture, constraint: "[^/\\?#\.]") { scan(/\w+/) } }
|
18
18
|
on(?\\) { |c| node(:char, expect(/./)) }
|
19
19
|
on(?() { |c| node(:optional, node(:group) { read unless scan(?)) }) }
|
20
20
|
on(?|) { |c| node(:or) }
|
data/lib/mustermann/version.rb
CHANGED
data/spec/grape_spec.rb
CHANGED
@@ -41,10 +41,10 @@ describe Mustermann::Grape do
|
|
41
41
|
pattern '/:foo' do
|
42
42
|
it { should match('/foo') .capturing foo: 'foo' }
|
43
43
|
it { should match('/bar') .capturing foo: 'bar' }
|
44
|
-
it { should match('/foo.bar') .capturing foo: 'foo.bar' }
|
45
44
|
it { should match('/%0Afoo') .capturing foo: '%0Afoo' }
|
46
45
|
it { should match('/foo%2Fbar') .capturing foo: 'foo%2Fbar' }
|
47
46
|
|
47
|
+
it { should_not match('/foo.bar') }
|
48
48
|
it { should_not match('/foo?') }
|
49
49
|
it { should_not match('/foo/bar') }
|
50
50
|
it { should_not match('/') }
|
@@ -59,10 +59,10 @@ describe Mustermann::Grape do
|
|
59
59
|
|
60
60
|
pattern "/:foo/:bar" do
|
61
61
|
it { should match('/foo/bar') .capturing foo: 'foo', bar: 'bar' }
|
62
|
-
it {
|
63
|
-
it {
|
64
|
-
it {
|
65
|
-
it {
|
62
|
+
it { should_not match('/foo.bar/bar.foo') }
|
63
|
+
it { should_not match('/user@example.com/name') }
|
64
|
+
it { should_not match('/10.1/te.st') }
|
65
|
+
it { should_not match('/10.1.2/te.st') }
|
66
66
|
|
67
67
|
it { should_not match('/foo%2Fbar') }
|
68
68
|
it { should_not match('/foo%2fbar') }
|
@@ -267,9 +267,9 @@ describe Mustermann::Grape do
|
|
267
267
|
it { should match('/pony%e6%ad%a3%2ejpg') .capturing file: 'pony%e6%ad%a3', ext: 'jpg' }
|
268
268
|
it { should match('/pony正%2Ejpg') .capturing file: 'pony正', ext: 'jpg' }
|
269
269
|
it { should match('/pony正%2ejpg') .capturing file: 'pony正', ext: 'jpg' }
|
270
|
-
it { should match('/pony正..jpg') .capturing file: 'pony正.', ext: 'jpg' }
|
271
270
|
|
272
|
-
it { should_not match('
|
271
|
+
it { should_not match('/pony正..jpg') }
|
272
|
+
it { should_not match('/.jpg') }
|
273
273
|
end
|
274
274
|
|
275
275
|
pattern '/(:a)x?' do
|
@@ -283,8 +283,8 @@ describe Mustermann::Grape do
|
|
283
283
|
|
284
284
|
pattern '/:user(@:host)?' do
|
285
285
|
it { should match('/foo@bar') .capturing user: 'foo', host: 'bar' }
|
286
|
-
it {
|
287
|
-
it {
|
286
|
+
it { should_not match('/foo.foo@bar') }
|
287
|
+
it { should_not match('/foo@bar.bar') }
|
288
288
|
|
289
289
|
it { should generate_template('/{user}') }
|
290
290
|
it { should generate_template('/{user}@{host}') }
|
@@ -295,9 +295,9 @@ describe Mustermann::Grape do
|
|
295
295
|
it { should match('/pony.jpg') .capturing file: 'pony', ext: 'jpg' }
|
296
296
|
it { should match('/pony%2Ejpg') .capturing file: 'pony', ext: 'jpg' }
|
297
297
|
it { should match('/pony%2ejpg') .capturing file: 'pony', ext: 'jpg' }
|
298
|
-
it {
|
299
|
-
it {
|
300
|
-
it { should_not match('/.jpg')
|
298
|
+
it { should_not match('/pony.png.jpg') }
|
299
|
+
it { should_not match('/pony.') }
|
300
|
+
it { should_not match('/.jpg') }
|
301
301
|
|
302
302
|
it { should generate_template('/{file}') }
|
303
303
|
it { should generate_template('/{file}.{ext}') }
|
@@ -314,24 +314,24 @@ describe Mustermann::Grape do
|
|
314
314
|
|
315
315
|
pattern '/10/:id' do
|
316
316
|
it { should match('/10/test') .capturing id: 'test' }
|
317
|
-
it {
|
317
|
+
it { should_not match('/10/te.st') }
|
318
318
|
end
|
319
319
|
|
320
320
|
pattern '/10.1/:id' do
|
321
321
|
it { should match('/10.1/test') .capturing id: 'test' }
|
322
|
-
it {
|
322
|
+
it { should_not match('/10.1/te.st') }
|
323
323
|
end
|
324
324
|
|
325
325
|
pattern '/:foo.:bar/:id' do
|
326
|
-
it {
|
327
|
-
it {
|
326
|
+
it { should_not match('/10.1/te.st') }
|
327
|
+
it { should_not match('/10.1.2/te.st') }
|
328
328
|
end
|
329
329
|
|
330
330
|
pattern '/:a/:b.?:c?' do
|
331
331
|
it { should match('/a/b') .capturing a: 'a', b: 'b', c: nil }
|
332
332
|
it { should match('/a/b.c') .capturing a: 'a', b: 'b', c: 'c' }
|
333
|
-
it {
|
334
|
-
it {
|
333
|
+
it { should_not match('/a.b/c') }
|
334
|
+
it { should_not match('/a.b/c.d') }
|
335
335
|
it { should_not match('/a.b/c.d/e') }
|
336
336
|
end
|
337
337
|
|
@@ -554,23 +554,23 @@ describe Mustermann::Grape do
|
|
554
554
|
it { should match('/pony.png') .capturing file: 'pony', ext: 'png' }
|
555
555
|
it { should match('/pony%2Epng') .capturing file: 'pony', ext: 'png' }
|
556
556
|
it { should match('/pony%2epng') .capturing file: 'pony', ext: 'png' }
|
557
|
-
it {
|
558
|
-
it {
|
559
|
-
it {
|
560
|
-
it {
|
561
|
-
it { should_not match('.jpg')
|
557
|
+
it { should_not match('/pony.png.jpg') }
|
558
|
+
it { should_not match('/pony.jpg.png') }
|
559
|
+
it { should_not match('/pony.gif') }
|
560
|
+
it { should_not match('/pony.') }
|
561
|
+
it { should_not match('.jpg') }
|
562
562
|
end
|
563
563
|
|
564
564
|
pattern '/:file:ext?', capture: { ext: ['.jpg', '.png', '.tar.gz'] } do
|
565
565
|
it { should match('/pony') .capturing file: 'pony', ext: nil }
|
566
566
|
it { should match('/pony.jpg') .capturing file: 'pony', ext: '.jpg' }
|
567
567
|
it { should match('/pony.png') .capturing file: 'pony', ext: '.png' }
|
568
|
-
it { should match('/pony.
|
569
|
-
it {
|
570
|
-
it {
|
571
|
-
it {
|
572
|
-
it {
|
573
|
-
it { should_not match('/.jpg')
|
568
|
+
it { should match('/pony.tar.gz') .capturing file: 'pony', ext: '.tar.gz' }
|
569
|
+
it { should_not match('/pony.png.jpg') }
|
570
|
+
it { should_not match('/pony.jpg.png') }
|
571
|
+
it { should_not match('/pony.gif') }
|
572
|
+
it { should_not match('/pony.') }
|
573
|
+
it { should_not match('/.jpg') }
|
574
574
|
end
|
575
575
|
|
576
576
|
pattern '/:a(@:b)?', capture: { b: /\d+/ } do
|
@@ -587,7 +587,7 @@ describe Mustermann::Grape do
|
|
587
587
|
pattern '/:file(.:ext)?', greedy: false do
|
588
588
|
it { should match('/pony') .capturing file: 'pony', ext: nil }
|
589
589
|
it { should match('/pony.jpg') .capturing file: 'pony', ext: 'jpg' }
|
590
|
-
it {
|
590
|
+
it { should_not match('/pony.png.jpg') }
|
591
591
|
end
|
592
592
|
|
593
593
|
pattern '/auth/*', except: '/auth/login' do
|