js-routes 0.9.5 → 0.9.6

Sign up to get free protection for your applications and to get access to all the features.
data/lib/js_routes.rb CHANGED
@@ -125,7 +125,7 @@ class JsRoutes
125
125
  def js_routes
126
126
  Rails.application.reload_routes!
127
127
  js_routes = Rails.application.routes.named_routes.routes.sort_by(&:to_s).map do |_, route|
128
- if route.app.respond_to?(:superclass) && route.app.superclass == Rails::Engine
128
+ if route.app.respond_to?(:superclass) && route.app.superclass == Rails::Engine && !route.path.anchored
129
129
  route.app.routes.named_routes.map do |_, engine_route|
130
130
  build_route_if_match(engine_route, route)
131
131
  end
@@ -1,3 +1,3 @@
1
1
  class JsRoutes
2
- VERSION = "0.9.5"
2
+ VERSION = "0.9.6"
3
3
  end
@@ -53,6 +53,9 @@ describe JsRoutes, "compatibility with Rails" do
53
53
  it "should support root path" do
54
54
  expect(evaljs("Routes.blog_app_root_path()")).to eq(blog_routes.root_path)
55
55
  end
56
+ it "should support single route mapping" do
57
+ expect(evaljs("Routes.support_path({page: 3})")).to eq(routes.support_path(:page => 3))
58
+ end
56
59
  end
57
60
 
58
61
  it "shouldn't require the format" do
@@ -185,6 +188,7 @@ describe JsRoutes, "compatibility with Rails" do
185
188
  it "should include the optional parts" do
186
189
  expect(evaljs("Routes.things_path({optional_id: 5})")).to eq(routes.things_path(:optional_id => 5))
187
190
  end
191
+
188
192
  end
189
193
  end
190
194
 
data/spec/spec_helper.rb CHANGED
@@ -62,6 +62,9 @@ def draw_routes
62
62
  resources :posts
63
63
  end
64
64
  App.routes.draw do
65
+
66
+ get 'support(/page/:page)', to: BlogEngine::Engine, as: 'support'
67
+
65
68
  resources :inboxes do
66
69
  resources :messages do
67
70
  resources :attachments
@@ -96,7 +99,6 @@ def draw_routes
96
99
 
97
100
  get '/привет' => "foo#foo", :as => :hello
98
101
  get '(/o/:organization)/search/:q' => "foo#foo", as: :search
99
-
100
102
  end
101
103
 
102
104
  end
data/temp ADDED
@@ -0,0 +1,2 @@
1
+ #<ActionDispatch::Journey::Route:0x007f8c4bdba798 @name="blog_app", @app=BlogEngine::Engine, @path=#<ActionDispatch::Journey::Path::Pattern:0x007f8c4bdbb120 @anchored=false, @spec=/blog, @requirements={}, @separators="/.?", @names=[], @optional_names=[], @required_names=[], @re=nil, @offsets=nil>, @dispatcher=false, @constraints={:required_defaults=>[]}, @defaults={}, @required_defaults=nil, @required_parts=[], @parts=[], @decorated_ast=nil, @precedence=61>
2
+ #<ActionDispatch::Journey::Route:0x007f8c4a861658 @name="support", @app=BlogEngine::Engine, @path=#<ActionDispatch::Journey::Path::Pattern:0x007f8c4a85c838 @anchored=true, @spec=/support(/page/:page)(.:format), @requirements={}, @separators="/.?", @names=["page", "format"], @optional_names=["page", "format"], @required_names=[], @re=nil, @offsets=nil>, @dispatcher=false, @constraints={:required_defaults=>[], :request_method=>/^GET$/}, @defaults={}, @required_defaults=nil, @required_parts=[], @parts=[:page, :format], @decorated_ast=nil, @precedence=0>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: js-routes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5
4
+ version: 0.9.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -173,6 +173,7 @@ files:
173
173
  - spec/js_routes/rails_routes_compatibility_spec.rb
174
174
  - spec/js_routes/zzz_last_post_rails_init_spec.rb
175
175
  - spec/spec_helper.rb
176
+ - temp
176
177
  homepage: http://github.com/railsware/js-routes
177
178
  licenses:
178
179
  - MIT
@@ -188,7 +189,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
188
189
  version: '0'
189
190
  segments:
190
191
  - 0
191
- hash: 2369940964485562575
192
+ hash: -1200992096390296436
192
193
  required_rubygems_version: !ruby/object:Gem::Requirement
193
194
  none: false
194
195
  requirements: