File tree Expand file tree Collapse file tree 4 files changed +18
-5
lines changed
Expand file tree Collapse file tree 4 files changed +18
-5
lines changed Original file line number Diff line number Diff line change 33## v2.3.1
44
55* Add timestamp on when routes where generated into banner
6+ * Fix application specified directly without proc. [ #323 ] ( https://github.com/railsware/js-routes/issues/323 )
67
78## v2.3.0
89
Original file line number Diff line number Diff line change @@ -117,7 +117,8 @@ def wrapper_variable
117117
118118 sig { returns ( Application ) }
119119 def application
120- @configuration . application . call
120+ app = @configuration . application
121+ app . is_a? ( Proc ) ? app . call : app
121122 end
122123
123124 sig { params ( value : T . untyped ) . returns ( String ) }
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ module Types
1717 JourneyRoute = T . type_alias { ActionDispatch ::Journey ::Route }
1818 RouteSpec = T . type_alias { T . untyped }
1919 Application = T . type_alias { T . any ( T ::Class [ Rails ::Engine ] , Rails ::Application ) }
20- ApplicationCaller = T . type_alias { T . proc . returns ( Application ) }
20+ ApplicationCaller = T . type_alias { T . any ( Application , T . proc . returns ( Application ) ) }
2121 Clusivity = T . type_alias { T . any ( Regexp , T ::Array [ Regexp ] ) }
2222 FileName = T . type_alias { T . any ( String , Pathname , NilClass ) }
2323 ConfigurationBlock = T . type_alias { T . proc . params ( arg0 : JsRoutes ::Configuration ) . void }
Original file line number Diff line number Diff line change 482482 end
483483
484484 describe "when application is specified" do
485- let ( :_options ) { { application : -> { BlogEngine ::Engine } } }
485+ context "as proc" do
486+ let ( :_options ) { { application : -> { BlogEngine ::Engine } } }
487+
488+ it "should include specified engine route" do
489+ expectjs ( "Routes.posts_path()" ) . not_to be_nil
490+ end
491+ end
492+
493+ context "directly" do
494+ let ( :_options ) { { application : BlogEngine ::Engine } }
495+
496+ it "should include specified engine route" do
497+ expectjs ( "Routes.posts_path()" ) . not_to be_nil
498+ end
486499
487- it "should include specified engine route" do
488- expectjs ( "Routes.posts_path()" ) . not_to be_nil
489500 end
490501 end
491502
You can’t perform that action at this time.
0 commit comments