coach 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/coach/router.rb +4 -1
- data/lib/coach/version.rb +1 -1
- data/spec/lib/coach/router_spec.rb +12 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e35fa8a294c55fd5d88d89a727ad8a7f0bec3126
|
4
|
+
data.tar.gz: 2f890526ccfa7f667736a5cfc15d757cafb3e6a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27bf1b60051bc71d710cce036dc2917f74cd74aef227d30a4ffa957f442ea64b851630ba8d9ce1923f6db49e96f7457dfe2e787837dd272d38911c04bff328ff
|
7
|
+
data.tar.gz: f4d518d61d844ade2875ac23ffe609e869e1ff20da4dcdf5a9cc392f2144f0ffc89980f8ee0e550fa20c92eb0e19898437b28a1f0a5f4cfbe946da7356f7c97f
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
# 0.4.4 / 2016-08-26
|
2
|
+
|
3
|
+
* [https://github.com/gocardless/coach/pull/16] Fix middleware lookup issue in router
|
4
|
+
|
5
|
+
# 0.4.3 / 2016-05-07
|
6
|
+
|
7
|
+
* [https://github.com/gocardless/coach/pull/15] Clean up `Coach::Handler#inspect`
|
8
|
+
|
1
9
|
# 0.4.2 / 2016-05-07
|
2
10
|
|
3
11
|
* [https://github.com/gocardless/coach/pull/13] Add support for Rails 5.
|
data/lib/coach/router.rb
CHANGED
@@ -17,7 +17,10 @@ module Coach
|
|
17
17
|
|
18
18
|
def draw(routes, base: nil, as: nil, constraints: nil, actions: [])
|
19
19
|
action_traits(actions).each do |action, traits|
|
20
|
-
|
20
|
+
# Passing false to const_get prevents it searching ancestors until a
|
21
|
+
# match is found. Without this, globally defined constants such as
|
22
|
+
# `Process` will be picked up before consts that need to be autoloaded.
|
23
|
+
route = routes.const_get(camel(action), false)
|
21
24
|
match(action_url(base, traits),
|
22
25
|
to: Handler.new(route),
|
23
26
|
via: traits[:method],
|
data/lib/coach/version.rb
CHANGED
@@ -12,14 +12,11 @@ describe Coach::Router do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
let(:resource_routes) do
|
15
|
-
Module.new
|
16
|
-
|
17
|
-
|
18
|
-
class Create; end
|
19
|
-
class Update; end
|
20
|
-
class Destroy; end
|
21
|
-
class Refund; end # custom
|
15
|
+
routes_module = Module.new
|
16
|
+
[:Index, :Show, :Create, :Update, :Destroy, :Refund].each do |class_name|
|
17
|
+
routes_module.const_set(class_name, Class.new)
|
22
18
|
end
|
19
|
+
routes_module
|
23
20
|
end
|
24
21
|
|
25
22
|
shared_examples "mount action" do |action, params|
|
@@ -74,5 +71,13 @@ describe Coach::Router do
|
|
74
71
|
expect { draw }.to raise_error(Coach::Errors::RouterUnknownDefaultAction)
|
75
72
|
end
|
76
73
|
end
|
74
|
+
|
75
|
+
context "with unknown action that clashes with a global constant name" do
|
76
|
+
let(:actions) { [process: { method: :post, url: ":id/process" }] }
|
77
|
+
|
78
|
+
it "raises NameError" do
|
79
|
+
expect { draw }.to raise_error(NameError)
|
80
|
+
end
|
81
|
+
end
|
77
82
|
end
|
78
83
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coach
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GoCardless
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|