js-routes 2.0.2 → 2.0.3

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
  SHA256:
3
- metadata.gz: 5c14ad3a055abd586066f226e79c08040e311aa8d76012983a52785acbc5ae94
4
- data.tar.gz: 330f6f56f13d6d6c48923b201ce75e24f07a9c9adac17cb599e64de7db1d3ad8
3
+ metadata.gz: 59b90f4f1eabd64f07f185e7fc3e26cc90ff44c0e705191543bfff3cb149e3ef
4
+ data.tar.gz: 3f10d123ffa344bf190f014e92796d51c4b3a63ea285ef4ee66376ce44adb7e7
5
5
  SHA512:
6
- metadata.gz: 21550a3ebe547e811e3fa7b3c343e5c332e9dd9f6a0bac9025a8cb29156b8c392aa57d45c556741427bd2f173dedd1ea98aa7d4fe17225c0b45f79a46eedc322
7
- data.tar.gz: 8b89660314d650dcf1091b277b615cdb653e7cd4b89b06ec676c0ad7cdd420f725930198f9f7cfe10e123d84e6085fefddd2df701f946dfcc91826047938b320
6
+ metadata.gz: f2211d6912507490776862a1f9a807b73ae2c77abaa247cfa71afcb8fbb87ec0c6f2fbb24d9219aff51a04e9eb8d47ab43c6e38ec0e598975bb3ccf5b2157b46
7
+ data.tar.gz: 8d2227c3bea7dec3fd3e92fd006752ce4af370f181f0e7115dc9870fb3b5f9d0ba4540398c6eae4de86096d1cf5a2b57de3396b08b63c2326191d0e1f0d5490a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## master
2
2
 
3
+ ## v2.0.3
4
+
5
+ * Fixed backward compatibility issue [#275](https://github.com/railsware/js-routes/issues/275)
6
+
3
7
  ## v2.0.2
4
8
 
5
9
  * Fixed backward compatibility issue [#274](https://github.com/railsware/js-routes/issues/274)
data/lib/js_routes.rb CHANGED
@@ -349,7 +349,7 @@ JS
349
349
  return spec.tr(':*', '') if spec.is_a?(String)
350
350
 
351
351
  result = serialize_spec(spec, parent_spec)
352
- if parent_spec && result[1].is_a?(String)
352
+ if parent_spec && result[1].is_a?(String) && parent_spec.type != :SLASH
353
353
  result = [
354
354
  # We encode node symbols as integer
355
355
  # to reduce the routes.js file size
@@ -1,3 +1,3 @@
1
1
  class JsRoutes
2
- VERSION = "2.0.2"
2
+ VERSION = "2.0.3"
3
3
  end
@@ -135,6 +135,10 @@ describe JsRoutes, "compatibility with Rails" do
135
135
  it "should support single route mapping" do
136
136
  expect(evaljs("Routes.support_path({page: 3})")).to eq(test_routes.support_path(:page => 3))
137
137
  end
138
+
139
+ it 'works' do
140
+ expect(evaljs("Routes.planner_manage_path()")).to eq(planner_routes.manage_path)
141
+ end
138
142
  end
139
143
 
140
144
  it "shouldn't require the format" do
data/spec/spec_helper.rb CHANGED
@@ -58,11 +58,21 @@ def blog_routes
58
58
  BlogEngine::Engine.routes.url_helpers
59
59
  end
60
60
 
61
+ def planner_routes
62
+ Planner::Engine.routes.url_helpers
63
+ end
64
+
61
65
  ActiveSupport::Inflector.inflections do |inflect|
62
66
  inflect.irregular "budgie", "budgies"
63
67
  end
64
68
 
65
69
 
70
+ module Planner
71
+ class Engine < Rails::Engine
72
+ isolate_namespace Planner
73
+ end
74
+ end
75
+
66
76
  module BlogEngine
67
77
  class Engine < Rails::Engine
68
78
  isolate_namespace BlogEngine
@@ -1,11 +1,17 @@
1
1
  def draw_routes
2
+ Planner::Engine.routes.draw do
3
+ get "/manage" => 'foo#foo', as: :manage
4
+ end
2
5
 
3
6
  BlogEngine::Engine.routes.draw do
4
7
  root to: "application#index"
5
- resources :posts
8
+ resources :posts, only: [:show, :index]
6
9
  end
7
10
  App.routes.draw do
8
11
 
12
+ mount Planner::Engine, at: "/", as: :planner
13
+
14
+ mount BlogEngine::Engine => "/blog", as: :blog_app
9
15
  get 'support(/page/:page)', to: BlogEngine::Engine, as: 'support'
10
16
 
11
17
  resources :inboxes, only: [:index, :show] do
@@ -43,8 +49,6 @@ def draw_routes
43
49
  get 'books/*section/:title' => 'books#show', :as => :book
44
50
  get 'books/:title/*section' => 'books#show', :as => :book_title
45
51
 
46
- mount BlogEngine::Engine => "/blog", :as => :blog_app
47
-
48
52
  get '/no_format' => "foo#foo", :format => false, :as => :no_format
49
53
 
50
54
  get '/json_only' => "foo#foo", :format => true, :constraints => {:format => /json/}, :as => :json_only
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: js-routes
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bogdan Gusiev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-26 00:00:00.000000000 Z
11
+ date: 2021-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties