strong_routes 0.9.2 → 0.9.3

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: 94bda3a08748c63e1c9589733d101e1b8e405257
4
- data.tar.gz: f32400f2da3aa6bec3148547081cae53e77d95c6
3
+ metadata.gz: 71eb6db636e7c67d3e3ca4df52256cd0ec42146d
4
+ data.tar.gz: fec00ffa91534d046242fa1be5560c91812c6744
5
5
  SHA512:
6
- metadata.gz: 739c0152f7d440928c6be349377da0e9b75388c01c7e8ed58bb0b5c059b14367cc704a5562682adcbbb0c8991d0e84ac0112f07703d0f3dccbb916c265e757ad
7
- data.tar.gz: b10a3d6c1ac0414a1bb6ccd16cf5e44eeec61ffbf807c11f6ef75fe8a9211ccdc583c4d127668e1ce2890d254f19bd12912dadb6d05974bc3c3e061ff4390269
6
+ metadata.gz: 878b70625b77b8c3722279681c2d7eb3cd51b367a06a29de18d278e067405a968af9ba91244f5140be6e71180e73cd29aa19f4a2edb2115acc713b398fe5e78d
7
+ data.tar.gz: aa4523e8ec53db12771933cd7bb2e83542c52cfa91bda5bea3ef61438ab343d0eb0a99d43b338f75269c67e022d2f9b46ac7ec24024a5cd5e467e3b0c1286c91
@@ -6,13 +6,6 @@ module StrongRoutes
6
6
  config.strong_routes = StrongRoutes.config
7
7
 
8
8
  initializer 'strong_routes.initialize' do |app|
9
- # Need to force Rails to load the routes since there's no way to hook
10
- # in after routes are loaded
11
- app.reload_routes!
12
-
13
- config.strong_routes.allowed_routes ||= []
14
- config.strong_routes.allowed_routes += RouteMapper.map(app.routes)
15
-
16
9
  case
17
10
  when config.strong_routes.insert_before? then
18
11
  app.config.middleware.insert_before(config.strong_routes.insert_before, Allow)
@@ -22,6 +15,17 @@ module StrongRoutes
22
15
  app.config.middleware.insert_before(::Rails::Rack::Logger, Allow)
23
16
  end
24
17
  end
18
+
19
+ # Load this late so initializers that depend on routes have a chance to
20
+ # initialize (i.e. Devise)
21
+ config.after_initialize do |app|
22
+ # Need to force Rails to load the routes since there's no way to hook
23
+ # in after routes are loaded
24
+ app.reload_routes!
25
+
26
+ config.strong_routes.allowed_routes ||= []
27
+ config.strong_routes.allowed_routes += RouteMapper.map(app.routes)
28
+ end
25
29
  end
26
30
  end
27
31
  end
@@ -1,3 +1,3 @@
1
1
  module StrongRoutes
2
- VERSION = "0.9.2"
2
+ VERSION = "0.9.3"
3
3
  end
@@ -4,15 +4,16 @@ require 'action_dispatch'
4
4
  require 'strong_routes/rails/route_mapper'
5
5
 
6
6
  describe ::StrongRoutes::Rails::RouteMapper do
7
- let(:paths) { [ 'users', 'posts', 'user_posts', 'bar', 'trading-post' ] }
7
+ let(:paths) { [ 'users', 'posts', 'comments', 'user_posts', 'bar', 'trading-post' ] }
8
8
  let(:route_set) {
9
9
  route_set = ActionDispatch::Routing::RouteSet.new
10
10
  route_set.draw do
11
11
  resources :users, :only => :index do
12
- resources :posts
12
+ resources :posts, :shallow => true do
13
+ resources :comments, :shallow => true
14
+ end
13
15
  end
14
16
 
15
- resources :posts, :only => :show
16
17
  resources :user_posts, :only => :show
17
18
 
18
19
  get 'bar/sandwich', :to => 'users#index'
@@ -23,7 +24,7 @@ describe ::StrongRoutes::Rails::RouteMapper do
23
24
 
24
25
  describe ".map" do
25
26
  it "maps routes to path strings" do
26
- ::StrongRoutes::Rails::RouteMapper.map(route_set).must_equal paths
27
+ ::StrongRoutes::Rails::RouteMapper.map(route_set).sort.must_equal paths.sort
27
28
  end
28
29
  end
29
30
 
@@ -31,7 +32,7 @@ describe ::StrongRoutes::Rails::RouteMapper do
31
32
  subject { ::StrongRoutes::Rails::RouteMapper.new(route_set) }
32
33
 
33
34
  it "maps routes to path strings" do
34
- subject.map.must_equal paths
35
+ subject.map.sort.must_equal paths.sort
35
36
  end
36
37
  end
37
38
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strong_routes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Hutchison