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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8fe46b4e391e9c45df5845126662d443a932432b
4
- data.tar.gz: 411908ac832580ab48e7681b0b205e93a1b0cf02
3
+ metadata.gz: e35fa8a294c55fd5d88d89a727ad8a7f0bec3126
4
+ data.tar.gz: 2f890526ccfa7f667736a5cfc15d757cafb3e6a8
5
5
  SHA512:
6
- metadata.gz: f6723e45d26aa33823f808f29e3793000be670c7a103698a404290e39098b1ff08cc9f3fd8df04f1cd23e7410f5b92ff771096bf4e95eaa925d5522b27a94ab1
7
- data.tar.gz: 6546cf73ea20a8a3367684dfc17e3187cc7200e5057cf5015aeb5cfdc05e587a57dcc3998839073950a32b943d85ecee48603e9943e3d3832d6f98bf6f1cbf4d
6
+ metadata.gz: 27bf1b60051bc71d710cce036dc2917f74cd74aef227d30a4ffa957f442ea64b851630ba8d9ce1923f6db49e96f7457dfe2e787837dd272d38911c04bff328ff
7
+ data.tar.gz: f4d518d61d844ade2875ac23ffe609e869e1ff20da4dcdf5a9cc392f2144f0ffc89980f8ee0e550fa20c92eb0e19898437b28a1f0a5f4cfbe946da7356f7c97f
@@ -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.
@@ -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
- route = routes.const_get(camel(action))
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],
@@ -1,3 +1,3 @@
1
1
  module Coach
2
- VERSION = '0.4.3'.freeze
2
+ VERSION = '0.4.4'.freeze
3
3
  end
@@ -12,14 +12,11 @@ describe Coach::Router do
12
12
  end
13
13
 
14
14
  let(:resource_routes) do
15
- Module.new do
16
- class Index; end
17
- class Show; end
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.3
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-07-25 00:00:00.000000000 Z
11
+ date: 2016-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack