regal 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/lib/regal/app.rb +1 -0
- data/lib/regal/version.rb +1 -1
- data/spec/regal/app_spec.rb +102 -0
- metadata +7 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 45ac2e7667747b949959086c13d4e1f9d8aafe68324c2c0124ad52ba34f7f99c
|
4
|
+
data.tar.gz: f48537179e64376e9d616859883e9ce88f016f79f1b99ece62cd009ec265597c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15d39814b9bc1b8f9b80e1a937c7b6dc5d9f26afd6d228d54dc4fa655e7043d87eeab8d5477d3cd711a7261172e06bba6f4ffb73ffecbfed4a06d2b3966184ff
|
7
|
+
data.tar.gz: 1f16718c266cbac372fa03c1ad99843de49b75eb15123945194d62f056ac1a8d8749adba34d03d51eeaac216490717c433469ca223d2edd842845843900bb5fb
|
data/lib/regal/app.rb
CHANGED
data/lib/regal/version.rb
CHANGED
data/spec/regal/app_spec.rb
CHANGED
@@ -592,6 +592,27 @@ module Regal
|
|
592
592
|
end
|
593
593
|
end
|
594
594
|
|
595
|
+
context 'an app that has a top-level capturing route' do
|
596
|
+
let :app do
|
597
|
+
App.new do
|
598
|
+
route :foo do
|
599
|
+
get do
|
600
|
+
'whatever'
|
601
|
+
end
|
602
|
+
end
|
603
|
+
end
|
604
|
+
end
|
605
|
+
|
606
|
+
it 'matches anything for the capture route' do
|
607
|
+
get '/something'
|
608
|
+
expect(last_response.status).to eq(200)
|
609
|
+
expect(last_response.body).to eq('whatever')
|
610
|
+
get '/something-else'
|
611
|
+
expect(last_response.status).to eq(200)
|
612
|
+
expect(last_response.body).to eq('whatever')
|
613
|
+
end
|
614
|
+
end
|
615
|
+
|
595
616
|
context 'an app that mounts another app' do
|
596
617
|
GoodbyeApp = App.create do
|
597
618
|
route 'goodbye' do
|
@@ -701,6 +722,87 @@ module Regal
|
|
701
722
|
end
|
702
723
|
end
|
703
724
|
|
725
|
+
context 'an app that has an mounted capturing route' do
|
726
|
+
let :app do
|
727
|
+
InnerApp = App.create do
|
728
|
+
route 'static' do
|
729
|
+
get do
|
730
|
+
'static'
|
731
|
+
end
|
732
|
+
end
|
733
|
+
|
734
|
+
route :bar do
|
735
|
+
get do
|
736
|
+
'inside'
|
737
|
+
end
|
738
|
+
end
|
739
|
+
end
|
740
|
+
|
741
|
+
App.new do
|
742
|
+
route 'foo' do
|
743
|
+
mount InnerApp
|
744
|
+
end
|
745
|
+
|
746
|
+
route :outside do
|
747
|
+
get do
|
748
|
+
'outside'
|
749
|
+
end
|
750
|
+
end
|
751
|
+
end
|
752
|
+
end
|
753
|
+
|
754
|
+
it 'prioritizes the static route' do
|
755
|
+
get '/foo/static'
|
756
|
+
expect(last_response.status).to eq(200)
|
757
|
+
expect(last_response.body).to eq('static')
|
758
|
+
end
|
759
|
+
|
760
|
+
it 'matches anything for the mounted capture route' do
|
761
|
+
get '/foo/this'
|
762
|
+
expect(last_response.status).to eq(200)
|
763
|
+
expect(last_response.body).to eq('inside')
|
764
|
+
end
|
765
|
+
|
766
|
+
it 'still matches anything for the parent capture route' do
|
767
|
+
get '/this'
|
768
|
+
expect(last_response.status).to eq(200)
|
769
|
+
expect(last_response.body).to eq('outside')
|
770
|
+
end
|
771
|
+
end
|
772
|
+
|
773
|
+
context 'an app that has two mounted capturing routes' do
|
774
|
+
let :app do
|
775
|
+
InnerApp1 = App.create do
|
776
|
+
route :bar do
|
777
|
+
get do
|
778
|
+
'inside 1'
|
779
|
+
end
|
780
|
+
end
|
781
|
+
end
|
782
|
+
|
783
|
+
InnerApp2 = App.create do
|
784
|
+
route :bar do
|
785
|
+
get do
|
786
|
+
'inside 2'
|
787
|
+
end
|
788
|
+
end
|
789
|
+
end
|
790
|
+
|
791
|
+
App.new do
|
792
|
+
route 'foo' do
|
793
|
+
mount InnerApp1
|
794
|
+
mount InnerApp2
|
795
|
+
end
|
796
|
+
end
|
797
|
+
end
|
798
|
+
|
799
|
+
it 'last capture route replaces earlier mounted capture route' do
|
800
|
+
get '/foo/this'
|
801
|
+
expect(last_response.status).to eq(200)
|
802
|
+
expect(last_response.body).to eq('inside 2')
|
803
|
+
end
|
804
|
+
end
|
805
|
+
|
704
806
|
context 'an app that groups routes together in scopes' do
|
705
807
|
let :app do
|
706
808
|
App.new do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: regal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Theo Hultberg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.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
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
description: ''
|
28
28
|
email:
|
29
29
|
- theo@iconara.net
|
@@ -61,14 +61,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '0'
|
63
63
|
requirements: []
|
64
|
-
|
65
|
-
rubygems_version: 2.4.5
|
64
|
+
rubygems_version: 3.0.1
|
66
65
|
signing_key:
|
67
66
|
specification_version: 4
|
68
67
|
summary: ''
|
69
68
|
test_files:
|
70
|
-
- spec/
|
69
|
+
- spec/spec_helper.rb
|
71
70
|
- spec/regal/request_spec.rb
|
72
71
|
- spec/regal/response_spec.rb
|
73
|
-
- spec/
|
74
|
-
has_rdoc:
|
72
|
+
- spec/regal/app_spec.rb
|