@@ -30,14 +30,14 @@ class Product < Linkable; end
30
30
get '/dashboard' , to : 'dashboard#index'
31
31
end
32
32
33
- url_helper ( :website ) { "http://www.rubyonrails.org/" }
34
- url_helper ( :linkable ) { |linkable | [ :"#{ linkable . linkable_type } " , { id : linkable . id } ] }
35
- url_helper ( :params ) { |params | params }
36
- url_helper ( :symbol ) { :basket }
37
- url_helper ( :hash ) { { controller : "basket" , action : "show" } }
38
- url_helper ( :array ) { [ :admin , :dashboard ] }
39
- url_helper ( :options ) { |options | [ :products , options ] }
40
- url_helper ( :defaults , size : 10 ) { |options | [ :products , options ] }
33
+ direct ( :website ) { "http://www.rubyonrails.org/" }
34
+ direct ( :linkable ) { |linkable | [ :"#{ linkable . linkable_type } " , { id : linkable . id } ] }
35
+ direct ( :params ) { |params | params }
36
+ direct ( :symbol ) { :basket }
37
+ direct ( :hash ) { { controller : "basket" , action : "show" } }
38
+ direct ( :array ) { [ :admin , :dashboard ] }
39
+ direct ( :options ) { |options | [ :products , options ] }
40
+ direct ( :defaults , size : 10 ) { |options | [ :products , options ] }
41
41
end
42
42
43
43
APP = build_app Routes
@@ -57,7 +57,7 @@ def setup
57
57
@safe_params = ActionController ::Parameters . new ( @path_params ) . permit ( :controller , :action )
58
58
end
59
59
60
- def test_custom_path_helper
60
+ def test_direct_paths
61
61
assert_equal "http://www.rubyonrails.org" , website_path
62
62
assert_equal "http://www.rubyonrails.org" , Routes . url_helpers . website_path
63
63
@@ -88,7 +88,7 @@ def test_custom_path_helper
88
88
assert_equal "/products?size=20" , Routes . url_helpers . defaults_path ( size : 20 )
89
89
end
90
90
91
- def test_custom_url_helper
91
+ def test_direct_urls
92
92
assert_equal "http://www.rubyonrails.org" , website_url
93
93
assert_equal "http://www.rubyonrails.org" , Routes . url_helpers . website_url
94
94
@@ -108,8 +108,8 @@ def test_custom_url_helper
108
108
assert_equal "http://www.example.com/basket" , Routes . url_helpers . symbol_url
109
109
assert_equal "http://www.example.com/basket" , hash_url
110
110
assert_equal "http://www.example.com/basket" , Routes . url_helpers . hash_url
111
- assert_equal "/ admin/dashboard" , array_path
112
- assert_equal "/ admin/dashboard" , Routes . url_helpers . array_path
111
+ assert_equal "http://www.example.com/ admin/dashboard" , array_url
112
+ assert_equal "http://www.example.com/ admin/dashboard" , Routes . url_helpers . array_url
113
113
114
114
assert_equal "http://www.example.com/products?page=2" , options_url ( page : 2 )
115
115
assert_equal "http://www.example.com/products?page=2" , Routes . url_helpers . options_url ( page : 2 )
0 commit comments