@@ -33,11 +33,10 @@ def test
3333 it "Example 1 - Async request with payload" do
3434
3535 Rails . application . routes . append do
36- post '/action_test' , to : 'action_test#test' , as : 'action_test'
36+ post '/action_test' , to : 'action_test#test' , as : 'action_test' unless path_exists? ( :action_test_path )
3737 end
3838 Rails . application . reload_routes!
3939
40-
4140 class ExamplePage < Matestack ::Ui ::Page
4241
4342 def response
@@ -72,11 +71,10 @@ def action_config
7271 it "Example 2 - Async request with URL param" do
7372
7473 Rails . application . routes . append do
75- post '/action_test/:id' , to : 'action_test#test' , as : 'action_test_with_url_param'
74+ post '/action_test/:id' , to : 'action_test#test' , as : 'action_test_with_url_param' unless path_exists? ( :action_test_with_url_param_path )
7675 end
7776 Rails . application . reload_routes!
7877
79-
8078 class ExamplePage < Matestack ::Ui ::Page
8179
8280 def response
@@ -124,10 +122,11 @@ def failure_test
124122 end
125123
126124 Rails . application . routes . append do
127- post '/success_action_test' , to : 'action_test#success_test' , as : 'success_action_test'
128- post '/failure_action_test' , to : 'action_test#failure_test' , as : 'failure_action_test'
125+ post '/success_action_test' , to : 'action_test#success_test' , as : 'success_action_test' unless path_exists? ( :success_action_test_path )
126+ post '/failure_action_test' , to : 'action_test#failure_test' , as : 'failure_action_test' unless path_exists? ( :failure_action_test_path )
129127 end
130128 Rails . application . reload_routes!
129+
131130 end
132131
133132 it "Example 3 - Async request with success event emit used for rerendering" do
@@ -354,12 +353,13 @@ def page2
354353
355354 Rails . application . routes . append do
356355 scope :action_test do
357- get 'page1' , to : 'example_app_pages#page1' , as : 'action_test_page1'
358- get 'page2/:id' , to : 'example_app_pages#page2' , as : 'action_test_page2'
356+ get 'page1' , to : 'example_app_pages#page1' , as : 'action_test_page1' unless path_exists? ( :action_test_page1_path )
357+ get 'page2/:id' , to : 'example_app_pages#page2' , as : 'action_test_page2' unless path_exists? ( :action_test_page2_path )
359358 end
360359 end
361360 Rails . application . reload_routes!
362361
362+
363363 visit "action_test/page1"
364364
365365 expect ( page ) . to have_content ( "My Example App Layout" )
@@ -393,7 +393,7 @@ def destroy
393393 end
394394
395395 Rails . application . routes . append do
396- delete '/action_test' , to : 'action_test#destroy' , as : 'action_destroy_test'
396+ delete '/action_test' , to : 'action_test#destroy' , as : 'action_destroy_test' unless path_exists? ( :action_destroy_test_path )
397397 end
398398 Rails . application . reload_routes!
399399
@@ -457,7 +457,7 @@ def destroy
457457 end
458458
459459 Rails . application . routes . append do
460- delete '/action_test' , to : 'action_test#destroy' , as : 'action_destroy_default_text_test'
460+ delete '/action_test' , to : 'action_test#destroy' , as : 'action_destroy_default_text_test' unless path_exists? ( :action_destroy_default_text_test_path )
461461 end
462462 Rails . application . reload_routes!
463463
@@ -612,10 +612,10 @@ def success_test
612612 end
613613
614614 Rails . application . routes . append do
615- post '/success_action_test' , to : 'action_test#success_test' , as : 'success_action_test_string'
615+ post '/success_action_test' , to : 'action_test#success_test' , as : 'success_action_test_string' unless path_exists? ( :success_action_test_string_path )
616616 scope :action_test do
617- get 'page1' , to : 'example_app_pages#page1' , as : 'action_test_page1_string'
618- get 'page2/:id' , to : 'example_app_pages#page2' , as : 'action_test_page2_string'
617+ get 'page1' , to : 'example_app_pages#page1' , as : 'action_test_page1_string' unless path_exists? ( :action_test_page1_string_path )
618+ get 'page2/:id' , to : 'example_app_pages#page2' , as : 'action_test_page2_string' unless path_exists? ( :action_test_page2_string_path )
619619 end
620620 end
621621 Rails . application . reload_routes!
@@ -761,7 +761,7 @@ def show
761761 end
762762
763763 Rails . application . routes . append do
764- resources :test_models
764+ resources :test_models unless path_exists? ( :test_models_path )
765765 end
766766 Rails . application . reload_routes!
767767
@@ -845,7 +845,7 @@ def show
845845 end
846846
847847 Rails . application . routes . append do
848- resources :test_models
848+ resources :test_models unless path_exists? ( :test_models_path )
849849 end
850850 Rails . application . reload_routes!
851851
0 commit comments