grape-path-helpers 1.6.2 → 1.7.1

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: 8df03144931341081ba2a02ba59cc45d6a74cc55a5d465d40cf8a333c5032ac1
4
+ data.tar.gz: 1a173198fadb720a0aa3a23632f2657ba24425fae84720dcf3703d3e8281fd71
5
5
  SHA512:
6
- metadata.gz: 0fecfaaab23602b4cc8f50a4a9356e228d69909b36f799000bce239798e443f35cb3aa0d2367d9980a0e58c41dd4f5671c501dab08a6fb94bfffb5148652d200
7
- data.tar.gz: a6c4dd8fb3cd7bb33a96687a94ac0e96733af8ecfe5096f781b32139c3518b96295763405086d05389f54adf66bf96bd4940352cf322c5135158f274f0420c11
6
+ metadata.gz: 855800980e102dc069cac30f31f85d77e0e8681fdd312b1a0d574151b9331ebd34fbb1b7756c06cd0ca4602f865b6d585841eef0da1b38cacf9e3b117b964b4d
7
+ data.tar.gz: ddeb1c0471150615131ed8d2af3c7dfc2b5ad9254c9f6046d0dd43d2e589511935a13107bf59502df3d6f8f7d378bedfee8bc04025f2aaec17537e9c29ac798a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.7.1
4
+
5
+ * Fix undefined method error (https://gitlab.com/gitlab-org/grape-path-helpers/-/merge_requests/42)
6
+
7
+ ## 1.7.0
8
+
9
+ * [Further improve performance of route matching](https://gitlab.com/gitlab-org/grape-path-helpers/-/merge_requests/38)
10
+
11
+ ## 1.6.3
12
+
13
+ * [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)
14
+
3
15
  ## 1.6.2
4
16
 
5
17
  * [Improve performance of route matching](https://gitlab.com/gitlab-org/grape-path-helpers/-/merge_requests/33)
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,40 @@
1
+ ## Developer Certificate of Origin and License
2
+
3
+ By contributing to GitLab B.V., you accept and agree to the following terms and
4
+ conditions for your present and future contributions submitted to GitLab B.V.
5
+ Except for the license granted herein to GitLab B.V. and recipients of software
6
+ distributed by GitLab B.V., you reserve all right, title, and interest in and to
7
+ your Contributions.
8
+
9
+ All contributions are subject to the Developer Certificate of Origin and license set out at [docs.gitlab.com/ce/legal/developer_certificate_of_origin](https://docs.gitlab.com/ce/legal/developer_certificate_of_origin).
10
+
11
+ _This notice should stay as the first item in the CONTRIBUTING.md file._
12
+
13
+ ## Code of conduct
14
+
15
+ As contributors and maintainers of this project, we pledge to respect all people
16
+ who contribute through reporting issues, posting feature requests, updating
17
+ documentation, submitting pull requests or patches, and other activities.
18
+
19
+ We are committed to making participation in this project a harassment-free
20
+ experience for everyone, regardless of level of experience, gender, gender
21
+ identity and expression, sexual orientation, disability, personal appearance,
22
+ body size, race, ethnicity, age, or religion.
23
+
24
+ Examples of unacceptable behavior by participants include the use of sexual
25
+ language or imagery, derogatory comments or personal attacks, trolling, public
26
+ or private harassment, insults, or other unprofessional conduct.
27
+
28
+ Project maintainers have the right and responsibility to remove, edit, or reject
29
+ comments, commits, code, wiki edits, issues, and other contributions that are
30
+ not aligned to this Code of Conduct. Project maintainers who do not follow the
31
+ Code of Conduct may be removed from the project team.
32
+
33
+ This code of conduct applies both within project spaces and in public spaces
34
+ when an individual is representing the project or its community.
35
+
36
+ Instances of abusive, harassing, or otherwise unacceptable behavior can be
37
+ reported by emailing contact@gitlab.com.
38
+
39
+ This Code of Conduct is adapted from the [Contributor Covenant](https://contributor-covenant.org), version 1.1.0,
40
+ available at [https://contributor-covenant.org/version/1/1/0/](https://contributor-covenant.org/version/1/1/0/).
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.7.1)
5
5
  activesupport
6
6
  grape (~> 1.3)
7
7
  rake (> 12)
@@ -10,51 +10,44 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activesupport (6.1.1)
13
+ activesupport (7.0.3.1)
14
14
  concurrent-ruby (~> 1.0, >= 1.0.2)
15
15
  i18n (>= 1.6, < 2)
16
16
  minitest (>= 5.1)
17
17
  tzinfo (~> 2.0)
18
- zeitwerk (~> 2.3)
19
18
  ast (2.4.0)
20
19
  builder (3.2.4)
21
20
  coderay (1.1.2)
22
- concurrent-ruby (1.1.7)
21
+ concurrent-ruby (1.1.10)
23
22
  diff-lcs (1.3)
24
- dry-configurable (0.12.0)
23
+ dry-container (0.10.1)
25
24
  concurrent-ruby (~> 1.0)
26
- dry-core (~> 0.5, >= 0.5.0)
27
- dry-container (0.7.2)
25
+ dry-core (0.8.1)
28
26
  concurrent-ruby (~> 1.0)
29
- dry-configurable (~> 0.1, >= 0.1.3)
30
- dry-core (0.5.0)
31
- concurrent-ruby (~> 1.0)
32
- dry-equalizer (0.3.0)
33
- dry-inflector (0.2.0)
34
- dry-logic (1.1.0)
27
+ dry-inflector (0.3.0)
28
+ dry-logic (1.2.0)
35
29
  concurrent-ruby (~> 1.0)
36
30
  dry-core (~> 0.5, >= 0.5)
37
- dry-types (1.4.0)
31
+ dry-types (1.5.1)
38
32
  concurrent-ruby (~> 1.0)
39
33
  dry-container (~> 0.3)
40
- dry-core (~> 0.4, >= 0.4.4)
41
- dry-equalizer (~> 0.3)
34
+ dry-core (~> 0.5, >= 0.5)
42
35
  dry-inflector (~> 0.1, >= 0.1.2)
43
36
  dry-logic (~> 1.0, >= 1.0.2)
44
- grape (1.5.1)
37
+ grape (1.6.2)
45
38
  activesupport
46
39
  builder
47
40
  dry-types (>= 1.1)
48
41
  mustermann-grape (~> 1.0.0)
49
42
  rack (>= 1.3.0)
50
43
  rack-accept
51
- i18n (1.8.7)
44
+ i18n (1.12.0)
52
45
  concurrent-ruby (~> 1.0)
53
46
  method_source (0.9.0)
54
- minitest (5.14.3)
55
- mustermann (1.1.1)
47
+ minitest (5.16.2)
48
+ mustermann (3.0.0)
56
49
  ruby2_keywords (~> 0.0.1)
57
- mustermann-grape (1.0.1)
50
+ mustermann-grape (1.0.2)
58
51
  mustermann (>= 1.0.0)
59
52
  parallel (1.12.1)
60
53
  parser (2.5.1.0)
@@ -63,11 +56,11 @@ GEM
63
56
  pry (0.11.3)
64
57
  coderay (~> 1.1.0)
65
58
  method_source (~> 0.9.0)
66
- rack (2.2.3)
59
+ rack (2.2.4)
67
60
  rack-accept (0.4.5)
68
61
  rack (>= 0.4)
69
62
  rainbow (3.0.0)
70
- rake (13.0.3)
63
+ rake (13.0.6)
71
64
  rspec (3.7.0)
72
65
  rspec-core (~> 3.7.0)
73
66
  rspec-expectations (~> 3.7.0)
@@ -89,11 +82,10 @@ GEM
89
82
  ruby-progressbar (~> 1.7)
90
83
  unicode-display_width (~> 1.0, >= 1.0.1)
91
84
  ruby-progressbar (1.9.0)
92
- ruby2_keywords (0.0.2)
93
- tzinfo (2.0.4)
85
+ ruby2_keywords (0.0.5)
86
+ tzinfo (2.0.5)
94
87
  concurrent-ruby (~> 1.0)
95
88
  unicode-display_width (1.3.3)
96
- zeitwerk (2.4.2)
97
89
 
98
90
  PLATFORMS
99
91
  ruby
data/README.md CHANGED
@@ -8,10 +8,6 @@ Provides named route helpers for Grape APIs, similar to [Rails' route helpers](h
8
8
 
9
9
  ### Installation
10
10
 
11
- #### Compatibility with Grape
12
-
13
- If you're using grape 0.16.0 or higher, you'll need version 2.0.0 or higher of grape-path-helpers.
14
-
15
11
  #### Rails
16
12
 
17
13
  p 1.) Add the gem to your Gemfile.
@@ -3,11 +3,24 @@ module GrapePathHelpers
3
3
  # list of routes from all APIs and decorate them with
4
4
  # the DecoratedRoute class
5
5
  module AllRoutes
6
- def decorated_routes
7
- # memoize so that construction of decorated routes happens once
8
- @decorated_routes ||= all_routes
9
- .map { |r| DecoratedRoute.new(r) }
10
- .sort_by { |r| -r.dynamic_path_segments.count }
6
+ def decorated_routes_by_helper_name
7
+ return @decorated_routes_by_helper_name if @decorated_routes_by_helper_name # rubocop:disable Metrics/LineLength
8
+
9
+ routes = {}
10
+
11
+ all_routes
12
+ .map { |r| DecoratedRoute.new(r) }
13
+ .sort_by { |r| -r.dynamic_path_segments.count }
14
+ .each do |route|
15
+ route.helper_names.each do |helper_name|
16
+ key = helper_name.to_sym
17
+
18
+ routes[key] ||= []
19
+ routes[key] << route
20
+ end
21
+ end
22
+
23
+ @decorated_routes_by_helper_name = routes
11
24
  end
12
25
 
13
26
  def all_routes
@@ -3,23 +3,24 @@ module GrapePathHelpers
3
3
  # to unknown methods will look for a route with a matching
4
4
  # helper function name
5
5
  module NamedRouteMatcher
6
- def method_missing(method_id, *args)
7
- return super unless method_id.to_s =~ /_path$/
6
+ def method_missing(method_name, *args)
7
+ return super unless method_name.end_with?('_path')
8
8
 
9
- segments = args.first || {}
9
+ possible_routes = Grape::API::Instance
10
+ .decorated_routes_by_helper_name[method_name]
11
+ return super unless possible_routes
10
12
 
11
- # rubocop:disable Metrics/LineLength
12
- raise ArgumentError, 'Helper options must be a hash' unless segments.is_a?(Hash)
13
- # rubocop:enable Metrics/LineLength
13
+ segments = args.first || {}
14
+ return super unless segments.is_a?(Hash)
14
15
 
15
16
  requested_segments = segments.keys.map(&:to_s)
16
17
 
17
- route = Grape::API::Instance.decorated_routes.detect do |r|
18
- route_match?(r, method_id, requested_segments)
18
+ route = possible_routes.detect do |r|
19
+ r.uses_segments_in_path_helper?(requested_segments)
19
20
  end
20
21
 
21
22
  if route
22
- route.send(method_id, *args)
23
+ route.send(method_name, *args)
23
24
  else
24
25
  super
25
26
  end
@@ -27,19 +28,13 @@ module GrapePathHelpers
27
28
  ruby2_keywords(:method_missing)
28
29
 
29
30
  def respond_to_missing?(method_name, _include_private = false)
30
- return super unless method_name =~ /_path$/
31
-
32
- Grape::API::Instance.decorated_routes.detect do |route|
33
- return true if route.respond_to?(method_name)
34
- end
35
-
36
- super
31
+ grape_route_path?(method_name) || super
37
32
  end
38
33
 
39
- def route_match?(route, method_name, requested_segments)
40
- return false unless route.respond_to?(method_name)
41
-
42
- route.uses_segments_in_path_helper?(requested_segments)
34
+ def grape_route_path?(method_name)
35
+ method_name.end_with?('_path') &&
36
+ !Grape::API::Instance
37
+ .decorated_routes_by_helper_name[method_name].nil?
43
38
  end
44
39
  end
45
40
  end
@@ -3,7 +3,12 @@ module GrapePathHelpers
3
3
  # and required arguments for every Grape::Route.
4
4
  class RouteDisplayer
5
5
  def route_attributes
6
- Grape::API::Instance.decorated_routes.map do |route|
6
+ Grape::API::Instance
7
+ .decorated_routes_by_helper_name
8
+ .values
9
+ .flatten
10
+ .uniq
11
+ .map do |route|
7
12
  {
8
13
  route_path: route.route_path,
9
14
  route_method: route.route_method,
@@ -1,4 +1,4 @@
1
1
  # Gem version
2
2
  module GrapePathHelpers
3
- VERSION = '1.6.2'.freeze
3
+ VERSION = '1.7.1'.freeze
4
4
  end
@@ -4,28 +4,6 @@ require 'spec_helper'
4
4
  describe GrapePathHelpers::NamedRouteMatcher do
5
5
  include described_class
6
6
 
7
- let(:routes) do
8
- Grape::API::Instance.decorated_routes
9
- end
10
-
11
- let(:ping_route) do
12
- routes.detect do |route|
13
- route.route_path =~ /ping/ && route.route_version == 'v1'
14
- end
15
- end
16
-
17
- let(:index_route) do
18
- routes.detect do |route|
19
- route.route_namespace =~ /cats$/
20
- end
21
- end
22
-
23
- let(:show_route) do
24
- routes.detect do |route|
25
- route.route_namespace =~ %r{cats/:id}
26
- end
27
- end
28
-
29
7
  let(:helper_class) do
30
8
  fake_class = Class.new do
31
9
  prepend GrapePathHelpers::NamedRouteMatcher
@@ -43,123 +21,61 @@ describe GrapePathHelpers::NamedRouteMatcher do
43
21
  end
44
22
 
45
23
  describe '#method_missing' do
46
- it 'returns super method_missing if the method does not end with path' do
47
- expect(Grape::API::Instance).not_to receive(:decorated_routes)
48
-
49
- expect(helper_class.test_method(:arg1, kwarg1: :kwarg1))
50
- .to eq([:test_method, [:arg1], { kwarg1: :kwarg1 }])
24
+ it 'returns super method_missing if the route does not exist' do
25
+ expect(helper_class.test_method(id: 1))
26
+ .to eq([:test_method, [], { id: 1 }])
51
27
  end
52
28
 
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
55
-
56
- helper_class.test_method_path
29
+ it 'returns super method_missing if first arg is not a hash' do
30
+ expect(helper_class.api_v1_cats_path(:arg1, kwarg1: :kwarg1))
31
+ .to eq([:api_v1_cats_path, [:arg1], { kwarg1: :kwarg1 }])
57
32
  end
58
33
 
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)
64
- end
65
- end
66
- end
67
-
68
- describe '#route_match?' do
69
- context 'when route responds to a method name' do
70
- let(:route) { ping_route }
71
- let(:method_name) { :api_v1_ping_path }
72
- let(:segments) { {} }
73
-
74
- it 'returns true' do
75
- is_match = route_match?(route, method_name, segments)
76
- expect(is_match).to eq(true)
34
+ context 'when method name matches a Grape::Route path helper name' do
35
+ it 'returns the path for that route object' do
36
+ expect(helper_class.api_v1_ping_path).to eq('/api/v1/ping.json')
77
37
  end
78
38
 
79
- context 'when requested segments contains expected options' do
80
- let(:segments) { { 'format' => 'xml' } }
81
-
82
- it 'returns true' do
83
- is_match = route_match?(route, method_name, segments)
84
- expect(is_match).to eq(true)
85
- end
86
-
87
- context 'when no dynamic segments are requested' do
88
- context 'when the route requires dynamic segments' do
89
- let(:route) { show_route }
90
- let(:method_name) { :ap1_v1_cats_path }
91
-
92
- it 'returns false' do
93
- is_match = route_match?(route, method_name, segments)
94
- expect(is_match).to eq(false)
95
- end
96
- end
97
-
98
- context 'when the route does not require dynamic segments' do
99
- it 'returns true' do
100
- is_match = route_match?(route, method_name, segments)
101
- expect(is_match).to eq(true)
102
- end
103
- end
104
- end
105
-
106
- context 'when route requires the requested segments' do
107
- let(:route) { show_route }
108
- let(:method_name) { :api_v1_cats_path }
109
- let(:segments) { { 'id' => 1 } }
110
-
111
- it 'returns true' do
112
- is_match = route_match?(route, method_name, segments)
113
- expect(is_match).to eq(true)
114
- end
115
- end
116
-
117
- context 'when route does not require the requested segments' do
118
- let(:segments) { { 'some_option' => 'some value' } }
119
-
120
- it 'returns false' do
121
- is_match = route_match?(route, method_name, segments)
122
- expect(is_match).to eq(false)
123
- end
39
+ context 'when route contains dynamic segments' do
40
+ it 'returns the path for that route object' do
41
+ expect(helper_class.api_v1_cats_path(id: 5))
42
+ .to eq('/api/v1/cats/5.json')
124
43
  end
125
44
  end
126
45
 
127
- context 'when segments contains unexpected options' do
128
- let(:segments) { { 'some_option' => 'some value' } }
129
-
130
- it 'returns false' do
131
- is_match = route_match?(route, method_name, segments)
132
- expect(is_match).to eq(false)
46
+ context 'when route requires dynamic segments but none are passed in' do
47
+ it 'returns super method_missing' do
48
+ expect(helper_class.api_v1_cats_owners_path)
49
+ .to eq([:api_v1_cats_owners_path, [], {}])
133
50
  end
134
51
  end
135
- end
136
52
 
137
- context 'when route does not respond to a method name' do
138
- let(:method_name) { :some_other_path }
139
- let(:route) { ping_route }
140
- let(:segments) { {} }
141
-
142
- it 'returns false' do
143
- is_match = route_match?(route, method_name, segments)
144
- expect(is_match).to eq(false)
53
+ context 'when route has no dynamic segments but some are passed in' do
54
+ it 'returns super method_missing' do
55
+ expect(helper_class.api_v1_ping_path(invalid: 'test'))
56
+ .to eq([:api_v1_ping_path, [], { invalid: 'test' }])
57
+ end
145
58
  end
146
59
  end
147
60
  end
148
61
 
149
62
  describe '#respond_to_missing?' do
150
- it 'returns super if the method does not end with path' do
151
- expect(Grape::API::Instance).not_to receive(:decorated_routes) # rubocop:disable Metrics/LineLength
63
+ context 'when method name doesnt end with _path suffix' do
64
+ let(:method_name) { :api_v1_cats }
152
65
 
153
- expect(helper_class.send(:respond_to_missing?, :test)).to eq(false)
154
- end
66
+ it 'returns false' do
67
+ expect(respond_to_missing?(method_name)).to eq(false)
68
+ end
155
69
 
156
- it 'search for the route if the method ends with path' do
157
- expect(Grape::API::Instance).to receive(:decorated_routes).and_call_original # rubocop:disable Metrics/LineLength
70
+ it 'doesnt execute decorated_routes_by_helper_name method' do
71
+ expect(Grape::API::Instance)
72
+ .not_to receive(:decorated_routes_by_helper_name)
158
73
 
159
- expect(helper_class.send(:respond_to_missing?, :test_path)).to eq(false)
74
+ respond_to_missing?(method_name)
75
+ end
160
76
  end
161
77
 
162
- context 'when method name with segments matches a Grape::Route path' do
78
+ context 'when method name matches a Grape::Route path with segments' do
163
79
  let(:method_name) { :api_v1_cats_path }
164
80
 
165
81
  it 'returns true' do
@@ -167,7 +83,7 @@ describe GrapePathHelpers::NamedRouteMatcher do
167
83
  end
168
84
  end
169
85
 
170
- context 'when method name matches a Grape::Route path helper name' do
86
+ context 'when method name matches a Grape::Route path' do
171
87
  let(:method_name) { :api_v1_ping_path }
172
88
 
173
89
  it 'returns true' do
@@ -175,7 +91,7 @@ describe GrapePathHelpers::NamedRouteMatcher do
175
91
  end
176
92
  end
177
93
 
178
- context 'when method name does not match a Grape::Route path helper name' do
94
+ context 'when method name does not match a Grape::Route path' do
179
95
  let(:method_name) { :some_other_path }
180
96
 
181
97
  it 'returns false' do
@@ -184,56 +100,44 @@ describe GrapePathHelpers::NamedRouteMatcher do
184
100
  end
185
101
  end
186
102
 
187
- describe '#method_missing' do
188
- context 'when method name matches a Grape::Route path helper name' do
189
- it 'returns the path for that route object' do
190
- path = api_v1_ping_path
191
- expect(path).to eq('/api/v1/ping.json')
192
- 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
- end
202
-
203
- context 'when method name does not match a Grape::Route path helper name' do
204
- it 'raises a NameError' do
205
- expect do
206
- some_method_name
207
- end.to raise_error(NameError)
208
- end
209
- end
210
- end
211
-
212
103
  context 'when Grape::Route objects share the same helper name' do
213
104
  context 'when helpers require different segments to generate their path' do
214
105
  it 'uses arguments to infer which route to use' do
215
- show_path = api_v1_cats_path('id' => 1)
106
+ show_path = helper_class.api_v1_cats_path(
107
+ 'id' => 1
108
+ )
216
109
  expect(show_path).to eq('/api/v1/cats/1.json')
217
110
 
218
- index_path = api_v1_cats_path
111
+ index_path = helper_class.api_v1_cats_path
219
112
  expect(index_path).to eq('/api/v1/cats.json')
220
113
  end
221
114
 
222
115
  it 'does not get shadowed by another route with less segments' do
223
- show_path = api_v1_cats_owners_path('id' => 1)
116
+ show_path = helper_class.api_v1_cats_owners_path(
117
+ 'id' => 1
118
+ )
224
119
  expect(show_path).to eq('/api/v1/cats/1/owners.json')
225
120
 
226
- show_path = api_v1_cats_owners_path('id' => 1, 'owner_id' => 1)
121
+ show_path = helper_class.api_v1_cats_owners_path(
122
+ 'id' => 1,
123
+ 'owner_id' => 1
124
+ )
227
125
  expect(show_path).to eq('/api/v1/cats/1/owners/1.json')
228
126
  end
229
127
  end
230
128
 
231
129
  context 'when query params are passed in' do
232
130
  it 'uses arguments to infer which route to use' do
233
- show_path = api_v1_cats_path('id' => 1, params: { 'foo' => 'bar' })
131
+ show_path = helper_class.api_v1_cats_path(
132
+ 'id' => 1,
133
+ params: { 'foo' => 'bar' }
134
+ )
135
+
234
136
  expect(show_path).to eq('/api/v1/cats/1.json?foo=bar')
235
137
 
236
- index_path = api_v1_cats_path(params: { 'foo' => 'bar' })
138
+ index_path = helper_class.api_v1_cats_path(
139
+ params: { 'foo' => 'bar' }
140
+ )
237
141
  expect(index_path).to eq('/api/v1/cats.json?foo=bar')
238
142
  end
239
143
  end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe GrapePathHelpers::RouteDisplayer do
4
+ subject(:route_displayer) { described_class.new }
5
+
6
+ describe '#route_attributes' do
7
+ subject { route_displayer.route_attributes }
8
+
9
+ it 'returns the list of attributes' do
10
+ is_expected.to include(a_hash_including(
11
+ route_path: '/:version/ping(.:format)',
12
+ route_method: 'GET',
13
+ helper_names: ['beta_1_ping_path'],
14
+ helper_arguments: []
15
+ ))
16
+ end
17
+ end
18
+ end
metadata CHANGED
@@ -1,15 +1,15 @@
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.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Drew Blessing
8
8
  - Harper Henn
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-05-06 00:00:00.000000000 Z
12
+ date: 2022-08-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -120,6 +120,7 @@ files:
120
120
  - ".rubocop.yml"
121
121
  - ".travis.yml"
122
122
  - CHANGELOG.md
123
+ - CONTRIBUTING.md
123
124
  - Gemfile
124
125
  - Gemfile.lock
125
126
  - LICENSE.txt
@@ -139,13 +140,14 @@ files:
139
140
  - spec/grape_path_helpers/all_routes_spec.rb
140
141
  - spec/grape_path_helpers/decorated_route_spec.rb
141
142
  - spec/grape_path_helpers/named_route_matcher_spec.rb
143
+ - spec/grape_path_helpers/route_displayer_spec.rb
142
144
  - spec/spec_helper.rb
143
145
  - spec/support/api.rb
144
146
  homepage: https://gitlab.com/gitlab-org/grape-path-helpers
145
147
  licenses:
146
148
  - MIT
147
149
  metadata: {}
148
- post_install_message:
150
+ post_install_message:
149
151
  rdoc_options: []
150
152
  require_paths:
151
153
  - lib
@@ -160,8 +162,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
162
  - !ruby/object:Gem::Version
161
163
  version: '0'
162
164
  requirements: []
163
- rubygems_version: 3.2.3
164
- signing_key:
165
+ rubygems_version: 3.3.19
166
+ signing_key:
165
167
  specification_version: 4
166
168
  summary: Route path helpers for Grape
167
169
  test_files: []