@@ -33,11 +33,10 @@ def test
33
33
it "Example 1 - Async request with payload" do
34
34
35
35
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 )
37
37
end
38
38
Rails . application . reload_routes!
39
39
40
-
41
40
class ExamplePage < Matestack ::Ui ::Page
42
41
43
42
def response
@@ -72,11 +71,10 @@ def action_config
72
71
it "Example 2 - Async request with URL param" do
73
72
74
73
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 )
76
75
end
77
76
Rails . application . reload_routes!
78
77
79
-
80
78
class ExamplePage < Matestack ::Ui ::Page
81
79
82
80
def response
@@ -124,10 +122,11 @@ def failure_test
124
122
end
125
123
126
124
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 )
129
127
end
130
128
Rails . application . reload_routes!
129
+
131
130
end
132
131
133
132
it "Example 3 - Async request with success event emit used for rerendering" do
@@ -354,12 +353,13 @@ def page2
354
353
355
354
Rails . application . routes . append do
356
355
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 )
359
358
end
360
359
end
361
360
Rails . application . reload_routes!
362
361
362
+
363
363
visit "action_test/page1"
364
364
365
365
expect ( page ) . to have_content ( "My Example App Layout" )
@@ -393,7 +393,7 @@ def destroy
393
393
end
394
394
395
395
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 )
397
397
end
398
398
Rails . application . reload_routes!
399
399
@@ -457,7 +457,7 @@ def destroy
457
457
end
458
458
459
459
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 )
461
461
end
462
462
Rails . application . reload_routes!
463
463
@@ -612,10 +612,10 @@ def success_test
612
612
end
613
613
614
614
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 )
616
616
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 )
619
619
end
620
620
end
621
621
Rails . application . reload_routes!
@@ -761,7 +761,7 @@ def show
761
761
end
762
762
763
763
Rails . application . routes . append do
764
- resources :test_models
764
+ resources :test_models unless path_exists? ( :test_models_path )
765
765
end
766
766
Rails . application . reload_routes!
767
767
@@ -845,7 +845,7 @@ def show
845
845
end
846
846
847
847
Rails . application . routes . append do
848
- resources :test_models
848
+ resources :test_models unless path_exists? ( :test_models_path )
849
849
end
850
850
Rails . application . reload_routes!
851
851
0 commit comments