grape-path-helpers 1.6.2 → 1.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +11 -13
- data/lib/grape-path-helpers/named_route_matcher.rb +1 -3
- data/lib/grape-path-helpers/version.rb +1 -1
- data/spec/grape_path_helpers/named_route_matcher_spec.rb +16 -17
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2bc6c862d4ba4b9cedabaafaf461382721dd87e45cc7796ff13d9a7c643d1d46
|
4
|
+
data.tar.gz: d1198670aad0447e4b50821a19e460daced596a51de2ddc0155fd6adea5146aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 729437ba35e3b8d4e2133dc96d11c9b5eca8a40965099acee11c7795f0514248bf7d45a824bc13cfceeb02e31fff0057f1a8ead11bc9e2f6d629af1b17910ed3
|
7
|
+
data.tar.gz: 520a330a0d892189dc2bd4862a717b41423f7c98794082592a961fdddbdee4342b1dbad0a94a9a4a98dbee2fa05c58bdc4c6ff398cddfbd74ad206622fb09fce
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.6.3
|
4
|
+
|
5
|
+
* [Fix route matcher when method ends in path and arg isn't a Hash](https://gitlab.com/gitlab-org/grape-path-helpers/-/merge_requests/35)
|
6
|
+
|
3
7
|
## 1.6.2
|
4
8
|
|
5
9
|
* [Improve performance of route matching](https://gitlab.com/gitlab-org/grape-path-helpers/-/merge_requests/33)
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
grape-path-helpers (1.6.
|
4
|
+
grape-path-helpers (1.6.3)
|
5
5
|
activesupport
|
6
6
|
grape (~> 1.3)
|
7
7
|
rake (> 12)
|
@@ -10,7 +10,7 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
activesupport (6.1.
|
13
|
+
activesupport (6.1.3.2)
|
14
14
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
15
|
i18n (>= 1.6, < 2)
|
16
16
|
minitest (>= 5.1)
|
@@ -19,9 +19,9 @@ GEM
|
|
19
19
|
ast (2.4.0)
|
20
20
|
builder (3.2.4)
|
21
21
|
coderay (1.1.2)
|
22
|
-
concurrent-ruby (1.1.
|
22
|
+
concurrent-ruby (1.1.8)
|
23
23
|
diff-lcs (1.3)
|
24
|
-
dry-configurable (0.12.
|
24
|
+
dry-configurable (0.12.1)
|
25
25
|
concurrent-ruby (~> 1.0)
|
26
26
|
dry-core (~> 0.5, >= 0.5.0)
|
27
27
|
dry-container (0.7.2)
|
@@ -29,29 +29,27 @@ GEM
|
|
29
29
|
dry-configurable (~> 0.1, >= 0.1.3)
|
30
30
|
dry-core (0.5.0)
|
31
31
|
concurrent-ruby (~> 1.0)
|
32
|
-
dry-equalizer (0.3.0)
|
33
32
|
dry-inflector (0.2.0)
|
34
|
-
dry-logic (1.
|
33
|
+
dry-logic (1.2.0)
|
35
34
|
concurrent-ruby (~> 1.0)
|
36
35
|
dry-core (~> 0.5, >= 0.5)
|
37
|
-
dry-types (1.
|
36
|
+
dry-types (1.5.1)
|
38
37
|
concurrent-ruby (~> 1.0)
|
39
38
|
dry-container (~> 0.3)
|
40
|
-
dry-core (~> 0.
|
41
|
-
dry-equalizer (~> 0.3)
|
39
|
+
dry-core (~> 0.5, >= 0.5)
|
42
40
|
dry-inflector (~> 0.1, >= 0.1.2)
|
43
41
|
dry-logic (~> 1.0, >= 1.0.2)
|
44
|
-
grape (1.5.
|
42
|
+
grape (1.5.3)
|
45
43
|
activesupport
|
46
44
|
builder
|
47
45
|
dry-types (>= 1.1)
|
48
46
|
mustermann-grape (~> 1.0.0)
|
49
47
|
rack (>= 1.3.0)
|
50
48
|
rack-accept
|
51
|
-
i18n (1.8.
|
49
|
+
i18n (1.8.10)
|
52
50
|
concurrent-ruby (~> 1.0)
|
53
51
|
method_source (0.9.0)
|
54
|
-
minitest (5.14.
|
52
|
+
minitest (5.14.4)
|
55
53
|
mustermann (1.1.1)
|
56
54
|
ruby2_keywords (~> 0.0.1)
|
57
55
|
mustermann-grape (1.0.1)
|
@@ -89,7 +87,7 @@ GEM
|
|
89
87
|
ruby-progressbar (~> 1.7)
|
90
88
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
91
89
|
ruby-progressbar (1.9.0)
|
92
|
-
ruby2_keywords (0.0.
|
90
|
+
ruby2_keywords (0.0.4)
|
93
91
|
tzinfo (2.0.4)
|
94
92
|
concurrent-ruby (~> 1.0)
|
95
93
|
unicode-display_width (1.3.3)
|
@@ -8,9 +8,7 @@ module GrapePathHelpers
|
|
8
8
|
|
9
9
|
segments = args.first || {}
|
10
10
|
|
11
|
-
|
12
|
-
raise ArgumentError, 'Helper options must be a hash' unless segments.is_a?(Hash)
|
13
|
-
# rubocop:enable Metrics/LineLength
|
11
|
+
return super unless segments.is_a?(Hash)
|
14
12
|
|
15
13
|
requested_segments = segments.keys.map(&:to_s)
|
16
14
|
|
@@ -50,17 +50,24 @@ describe GrapePathHelpers::NamedRouteMatcher do
|
|
50
50
|
.to eq([:test_method, [:arg1], { kwarg1: :kwarg1 }])
|
51
51
|
end
|
52
52
|
|
53
|
-
|
54
|
-
|
53
|
+
context 'when method ends with path' do
|
54
|
+
it 'returns super method_missing if first arg is not a hash' do
|
55
|
+
expect(Grape::API::Instance).not_to receive(:decorated_routes)
|
55
56
|
|
56
|
-
|
57
|
-
|
57
|
+
expect(helper_class.test_method_path(:arg1, kwarg1: :kwarg1))
|
58
|
+
.to eq([:test_method_path, [:arg1], { kwarg1: :kwarg1 }])
|
59
|
+
end
|
58
60
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
61
|
+
it 'search for the route if there are no args' do
|
62
|
+
expect(Grape::API::Instance).to receive(:decorated_routes).and_call_original # rubocop:disable Metrics/LineLength
|
63
|
+
|
64
|
+
helper_class.test_method_path
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'search for the route if the first arg is a hash' do
|
68
|
+
expect(Grape::API::Instance).to receive(:decorated_routes).and_call_original # rubocop:disable Metrics/LineLength
|
69
|
+
|
70
|
+
helper_class.test_method_path(id: 5)
|
64
71
|
end
|
65
72
|
end
|
66
73
|
end
|
@@ -190,14 +197,6 @@ describe GrapePathHelpers::NamedRouteMatcher do
|
|
190
197
|
path = api_v1_ping_path
|
191
198
|
expect(path).to eq('/api/v1/ping.json')
|
192
199
|
end
|
193
|
-
|
194
|
-
context 'when argument to the helper is not a hash' do
|
195
|
-
it 'raises an ArgumentError' do
|
196
|
-
expect do
|
197
|
-
api_v1_ping_path(1234)
|
198
|
-
end.to raise_error(ArgumentError)
|
199
|
-
end
|
200
|
-
end
|
201
200
|
end
|
202
201
|
|
203
202
|
context 'when method name does not match a Grape::Route path helper name' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grape-path-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Drew Blessing
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-05-
|
12
|
+
date: 2021-05-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|