grape-path-helpers 1.0.3 → 1.0.4

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: b8b63fdab374d8ffb25a82346ca56937710b7473
4
- data.tar.gz: a7b44b0fb974d4b43c03fd71c5777b5d84943e2f
3
+ metadata.gz: b85249a82d094a43fb63d463cb9e5d4d70786255
4
+ data.tar.gz: 1d1045657453e0beb3065b0489b28db4005c672a
5
5
  SHA512:
6
- metadata.gz: 3091465e660ea2dd3d5f2aff19525ca3c2def1dbb3e37fea62e4ed7add36aa1938d46d42e3a9cadd1449a023ee78b516b2b76f73fa323c8370a56eefef402c3e
7
- data.tar.gz: b2e5b4cd5294253c84fa58fe06cf1c43cfd0bd67aaac0b60d469e6c276ec1550d1e0feb2a3e7525648d52358f83e60ff13c40cc884357f0413838d3836a4c6b2
6
+ metadata.gz: 53cf4dff97fa1ab0d0578e28353bbc5ec8fa7d710a5a2d568a013ea7d9e681ff87855f33fd78baec99fe4c5877466a77f1af670cbd2c8069afe26897c637ce06
7
+ data.tar.gz: 0daa52606285e48aa7e89ca85f78a70d905430e49aca1964727a0e083d42b71f03bd8adf6dc8662c23bef7ab303119db5f1f763adbf400254858e6bc1445a745
@@ -1,9 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.4
4
+
5
+ * [Fix respond_to_missing? for included modules](https://gitlab.com/gitlab-org/grape-path-helpers/merge_requests/8)
6
+
3
7
  ## 1.0.3
4
8
 
5
9
  * [Fix return value in method_missing? implementation](https://gitlab.com/gitlab-org/grape-path-helpers/merge_requests/7)
6
- * [Fix broken method_missing? implementation](https://gitlab.com/gitlab-org/grape-path-helpers/merge_requests/6)
10
+ * [Fix broken respond_to_missing? implementation](https://gitlab.com/gitlab-org/grape-path-helpers/merge_requests/6)
7
11
 
8
12
  ## 1.0.2
9
13
 
@@ -20,11 +20,13 @@ module GrapePathHelpers
20
20
  end
21
21
 
22
22
  def respond_to_missing?(method_name, _include_private = false)
23
+ return super unless method_name =~ /_path$/
24
+
23
25
  Grape::API.decorated_routes.detect do |route|
24
26
  return true if route.respond_to?(method_name)
25
27
  end
26
28
 
27
- false
29
+ super
28
30
  end
29
31
 
30
32
  def route_match?(route, method_name, segments)
@@ -1,4 +1,4 @@
1
1
  # Gem version
2
2
  module GrapePathHelpers
3
- VERSION = '1.0.3'.freeze
3
+ VERSION = '1.0.4'.freeze
4
4
  end
@@ -146,6 +146,18 @@ describe GrapePathHelpers::NamedRouteMatcher do
146
146
  end
147
147
 
148
148
  describe '#respond_to_missing?' do
149
+ it 'returns super if the method doesb not end with path' do
150
+ expect(Grape::API).not_to receive(:decorated_routes)
151
+
152
+ expect(helper_class.send(:respond_to_missing?, :test)).to eq(false)
153
+ end
154
+
155
+ it 'search for the route if the method ends with path' do
156
+ expect(Grape::API).to receive(:decorated_routes).and_call_original
157
+
158
+ expect(helper_class.send(:respond_to_missing?, :test_path)).to eq(false)
159
+ end
160
+
149
161
  context 'when method name with segments matches a Grape::Route path' do
150
162
  let(:method_name) { :api_v1_cats_path }
151
163
 
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.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Drew Blessing