Created
June 24, 2016 15:24
-
-
Save bogdan/a097ef3d7df06c0045cc6ed335627805 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/spec/js_routes/rails_routes_compatibility_spec.rb b/spec/js_routes/rails_routes_compatibility_spec.rb | |
index ff0a480..6f027f7 100644 | |
--- a/spec/js_routes/rails_routes_compatibility_spec.rb | |
+++ b/spec/js_routes/rails_routes_compatibility_spec.rb | |
@@ -93,6 +93,14 @@ describe JsRoutes, "compatibility with Rails" do | |
it "should support single route mapping" do | |
expect(evaljs("Routes.support_path({page: 3})")).to eq(routes.support_path(:page => 3)) | |
end | |
+ | |
+ describe "anonymous" do | |
+ it "should work" do | |
+ expect(evaljs("Routes.products_engine_confirm_action_product_path(1, 'zz')")).to eq(products_routes.confirm_action_product_path(1, 'zz')) | |
+ expect(evaljs("Routes.products_engine_path()")).to eq(routes.products_engine_path) | |
+ end | |
+ | |
+ end | |
end | |
it "shouldn't require the format" do | |
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb | |
index f2903fb..04824ff 100644 | |
--- a/spec/spec_helper.rb | |
+++ b/spec/spec_helper.rb | |
@@ -42,6 +42,10 @@ def blog_routes | |
BlogEngine::Engine.routes.url_helpers | |
end | |
+def products_routes | |
+ ProductsEngine::Engine.routes.url_helpers | |
+end | |
+ | |
ActiveSupport::Inflector.inflections do |inflect| | |
inflect.irregular "budgie", "budgies" | |
end | |
@@ -53,6 +57,12 @@ module BlogEngine | |
end | |
end | |
+module ProductsEngine | |
+ class Engine < Rails::Engine | |
+ isolate_namespace ProductsEngine | |
+ end | |
+ | |
+end | |
class App < Rails::Application | |
@@ -76,6 +86,13 @@ def draw_routes | |
root to: "application#index" | |
resources :posts | |
end | |
+ ProductsEngine::Engine.routes.draw do | |
+ resources :bags, as: 'product', except: [:destroy] do |product| | |
+ member do | |
+ get 'confirm-action/:type' ,:as => :confirm_action, :action => :confirm_action | |
+ end | |
+ end | |
+ end | |
App.routes.draw do | |
get 'support(/page/:page)', to: BlogEngine::Engine, as: 'support' | |
@@ -110,6 +127,7 @@ def draw_routes | |
get 'books/:title/*section' => 'books#show', :as => :book_title | |
mount BlogEngine::Engine => "/blog", :as => :blog_app | |
+ mount ProductsEngine::Engine => "/products" | |
get '/no_format' => "foo#foo", :format => false, :as => :no_format | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment