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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b657d781342db968ae5f3aa2870ae038b2dcbe6d
4
- data.tar.gz: 7e3f3769de07852525cf560cc1b053f31ff90be9
3
+ metadata.gz: 0213dc6d9a2c7638cac33790888dfaaa7da56258
4
+ data.tar.gz: 2c5628b7ce6f0d6c83693f714de0b6b634a411c6
5
5
  SHA512:
6
- metadata.gz: 82059db05fce899ea10ec6d729d4411a7d5073052c66dba13710df0f17a7472fc79d0345225f1b760bd9cf16c3d4e32d822502fe8271e2efd78bac449d7acbcc
7
- data.tar.gz: ddab562925edbfe2f4fe85af92d7e86945077965b6407cce6960796945fad76234b1c158dca4dd06442fd3dc66f805fef532005f8007613d1251dc652832985e
6
+ metadata.gz: 4adbeefe8e9c58a9478dbe235029d55234aba29c70bea436b9ae8bdf1a1f03c031fb80ec92bf2d6ad7401ee4180b9ea3d690b4554032ee6e14644066661976da
7
+ data.tar.gz: 95c9a1d24af3a7823469cc04bb22fda9a3232723d0c7b3a6f7cbf6cb1dfd0d588b6f5138e3e035413a1636b421d190f5faa43d5f396632462c9c70c921de0bdd
@@ -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) }
@@ -1,3 +1,3 @@
1
1
  module Mustermann
2
- VERSION ||= '0.4.1'
2
+ VERSION ||= '0.4.2'
3
3
  end
@@ -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 { should match('/foo.bar/bar.foo') .capturing foo: 'foo.bar', bar: 'bar.foo' }
63
- it { should match('/user@example.com/name') .capturing foo: 'user@example.com', bar: 'name' }
64
- it { should match('/10.1/te.st') .capturing foo: '10.1', bar: 'te.st' }
65
- it { should match('/10.1.2/te.st') .capturing foo: '10.1.2', bar: 'te.st' }
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('/.jpg') }
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 { should match('/foo.foo@bar') .capturing user: 'foo.foo', host: 'bar' }
287
- it { should match('/foo@bar.bar') .capturing user: 'foo', host: 'bar.bar' }
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 { should match('/pony.png.jpg') .capturing file: 'pony.png', ext: 'jpg' }
299
- it { should match('/pony.') .capturing file: 'pony.' }
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 { should match('/10/te.st') .capturing id: 'te.st' }
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 { should match('/10.1/te.st') .capturing id: 'te.st' }
322
+ it { should_not match('/10.1/te.st') }
323
323
  end
324
324
 
325
325
  pattern '/:foo.:bar/:id' do
326
- it { should match('/10.1/te.st') .capturing foo: "10", bar: "1", id: "te.st" }
327
- it { should match('/10.1.2/te.st') .capturing foo: "10.1", bar: "2", id: "te.st" }
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 { should match('/a.b/c') .capturing a: 'a.b', b: 'c', c: nil }
334
- it { should match('/a.b/c.d') .capturing a: 'a.b', b: 'c', c: 'd' }
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 { should match('/pony.png.jpg') .capturing file: 'pony.png', ext: 'jpg' }
558
- it { should match('/pony.jpg.png') .capturing file: 'pony.jpg', ext: 'png' }
559
- it { should match('/pony.gif') .capturing file: 'pony.gif', ext: nil }
560
- it { should match('/pony.') .capturing file: 'pony.', ext: nil }
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.png.jpg') .capturing file: 'pony.png', ext: '.jpg' }
569
- it { should match('/pony.jpg.png') .capturing file: 'pony.jpg', ext: '.png' }
570
- it { should match('/pony.tar.gz') .capturing file: 'pony', ext: '.tar.gz' }
571
- it { should match('/pony.gif') .capturing file: 'pony.gif', ext: nil }
572
- it { should match('/pony.') .capturing file: 'pony.', ext: nil }
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 { should match('/pony.png.jpg') .capturing file: 'pony', ext: 'png.jpg' }
590
+ it { should_not match('/pony.png.jpg') }
591
591
  end
592
592
 
593
593
  pattern '/auth/*', except: '/auth/login' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mustermann19
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Haase