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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8734d9daeae94b2a878f9fc18e9c178546e3228132df7ed03a0b3e1ab4de9a2c
4
- data.tar.gz: 7151c3498b0957a40be8fdf9751aea18a62628c01379a5861116c5f855910c60
3
+ metadata.gz: 2bc6c862d4ba4b9cedabaafaf461382721dd87e45cc7796ff13d9a7c643d1d46
4
+ data.tar.gz: d1198670aad0447e4b50821a19e460daced596a51de2ddc0155fd6adea5146aa
5
5
  SHA512:
6
- metadata.gz: 0fecfaaab23602b4cc8f50a4a9356e228d69909b36f799000bce239798e443f35cb3aa0d2367d9980a0e58c41dd4f5671c501dab08a6fb94bfffb5148652d200
7
- data.tar.gz: a6c4dd8fb3cd7bb33a96687a94ac0e96733af8ecfe5096f781b32139c3518b96295763405086d05389f54adf66bf96bd4940352cf322c5135158f274f0420c11
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.2)
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.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.7)
22
+ concurrent-ruby (1.1.8)
23
23
  diff-lcs (1.3)
24
- dry-configurable (0.12.0)
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.1.0)
33
+ dry-logic (1.2.0)
35
34
  concurrent-ruby (~> 1.0)
36
35
  dry-core (~> 0.5, >= 0.5)
37
- dry-types (1.4.0)
36
+ dry-types (1.5.1)
38
37
  concurrent-ruby (~> 1.0)
39
38
  dry-container (~> 0.3)
40
- dry-core (~> 0.4, >= 0.4.4)
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.1)
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.7)
49
+ i18n (1.8.10)
52
50
  concurrent-ruby (~> 1.0)
53
51
  method_source (0.9.0)
54
- minitest (5.14.3)
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.2)
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
- # rubocop:disable Metrics/LineLength
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
 
@@ -1,4 +1,4 @@
1
1
  # Gem version
2
2
  module GrapePathHelpers
3
- VERSION = '1.6.2'.freeze
3
+ VERSION = '1.6.3'.freeze
4
4
  end
@@ -50,17 +50,24 @@ describe GrapePathHelpers::NamedRouteMatcher do
50
50
  .to eq([:test_method, [:arg1], { kwarg1: :kwarg1 }])
51
51
  end
52
52
 
53
- it 'search for the route if the method ends with path' do
54
- expect(Grape::API::Instance).to receive(:decorated_routes).and_call_original # rubocop:disable Metrics/LineLength
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
- helper_class.test_method_path
57
- end
57
+ expect(helper_class.test_method_path(:arg1, kwarg1: :kwarg1))
58
+ .to eq([:test_method_path, [:arg1], { kwarg1: :kwarg1 }])
59
+ end
58
60
 
59
- context 'when segments is not a hash' do
60
- it 'raises an ArgumentError' do
61
- expect do
62
- helper_class.test_method_path(1234)
63
- end.to raise_error(ArgumentError)
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.2
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-06 00:00:00.000000000 Z
12
+ date: 2021-05-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport