grape-route-helpers 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +2 -2
- data/grape-route-helpers.gemspec +1 -1
- data/lib/grape-route-helpers/all_routes.rb +1 -1
- data/lib/grape-route-helpers/version.rb +1 -1
- data/spec/grape_route_helpers/all_routes_spec.rb +10 -2
- data/spec/grape_route_helpers/decorated_route_spec.rb +8 -0
- data/spec/support/api.rb +11 -0
- metadata +2 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2bdf855209f4731d0d522b8e0b8a6df50913e437
|
4
|
+
data.tar.gz: 410ff06bb630ce4f87fe41a97ff9c7c610236235
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 731a34ae06496c10f3fcd1e55bc6fdbc155f3c08559cab2843e35c3e7efe7006d90ac4192eb724299a8e8f120654ca0c3c7102d9b90012b9941311c0f801ae1b
|
7
|
+
data.tar.gz: e7f775f3fb66a7f8b7bd58ff124b5973a9d6a3df5dca087edc1d407535d4451bc36800a49e2eff90e78e536a4389dbf0af76dbcfa1eb7c7d3c0ae6047ae5832b
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## December 17 2016
|
4
|
+
|
5
|
+
* Bump to 2.1.0
|
6
|
+
* Fix bug that caused POST routes to be ignored if more than one was defined
|
7
|
+
* Many thanks to @njd5475 for the bug report and pull request that helped me write this
|
8
|
+
|
3
9
|
## April 28 2016
|
4
10
|
|
5
11
|
* Release 2.0.0
|
data/Gemfile.lock
CHANGED
data/grape-route-helpers.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |gem|
|
|
11
11
|
gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
12
12
|
gem.homepage = 'https://github.com/reprah/grape-route-helpers'
|
13
13
|
|
14
|
-
gem.add_runtime_dependency 'grape', '
|
14
|
+
gem.add_runtime_dependency 'grape', '>= 0.16.0'
|
15
15
|
gem.add_runtime_dependency 'activesupport'
|
16
16
|
gem.add_runtime_dependency 'rake'
|
17
17
|
|
@@ -12,7 +12,7 @@ describe GrapeRouteHelpers::AllRoutes do
|
|
12
12
|
|
13
13
|
# A route is unique if no other route shares the same set of options
|
14
14
|
all_route_options = Grape::API.all_routes.map do |r|
|
15
|
-
r.instance_variable_get(:@options)
|
15
|
+
r.instance_variable_get(:@options).merge(path: r.path)
|
16
16
|
end
|
17
17
|
|
18
18
|
duplicates = all_route_options.select do |o|
|
@@ -20,7 +20,15 @@ describe GrapeRouteHelpers::AllRoutes do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
expect(duplicates).to be_empty
|
23
|
-
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'when there are multiple POST routes with the same namespace in the same API' do
|
27
|
+
it 'returns all POST routes' do
|
28
|
+
expected_routes = Spec::Support::MultiplePostsAPI.routes.map(&:path)
|
29
|
+
|
30
|
+
all_routes = Grape::API.all_routes
|
31
|
+
expect(all_routes.map(&:path)).to include(*expected_routes)
|
24
32
|
end
|
25
33
|
end
|
26
34
|
end
|
@@ -60,6 +60,14 @@ describe GrapeRouteHelpers::DecoratedRoute do
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
+
context 'when an API has multiple POST routes in a resource' do
|
64
|
+
let(:api) { Spec::Support::MultiplePostsAPI }
|
65
|
+
|
66
|
+
it 'it creates a helper for each POST route' do
|
67
|
+
expect(routes.size).to eq(2)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
63
71
|
context 'when an API has multiple versions' do
|
64
72
|
let(:api) { Spec::Support::APIWithMultipleVersions }
|
65
73
|
|
data/spec/support/api.rb
CHANGED
metadata
CHANGED
@@ -1,22 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grape-route-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Harper Henn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: grape
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0.16'
|
20
17
|
- - ">="
|
21
18
|
- !ruby/object:Gem::Version
|
22
19
|
version: 0.16.0
|
@@ -24,9 +21,6 @@ dependencies:
|
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
|
-
- - "~>"
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '0.16'
|
30
24
|
- - ">="
|
31
25
|
- !ruby/object:Gem::Version
|
32
26
|
version: 0.16.0
|