From d67e2520289745913e7bab9a852c86b99245f738 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Mon, 20 Feb 2017 14:37:00 +0000 Subject: [PATCH] Add test for calling a url helper in Mapper#direct --- .../test/dispatch/routing/custom_url_helpers_test.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/actionpack/test/dispatch/routing/custom_url_helpers_test.rb b/actionpack/test/dispatch/routing/custom_url_helpers_test.rb index bf4b323cf0..22e8bbf21e 100644 --- a/actionpack/test/dispatch/routing/custom_url_helpers_test.rb +++ b/actionpack/test/dispatch/routing/custom_url_helpers_test.rb @@ -32,6 +32,7 @@ class Product < Linkable; end direct(:website) { "http://www.rubyonrails.org" } direct("string") { "http://www.rubyonrails.org" } + direct(:helper) { basket_url } direct(:linkable) { |linkable| [:"#{linkable.linkable_type}", { id: linkable.id }] } direct(:params) { |params| params } direct(:symbol) { :basket } @@ -65,6 +66,9 @@ def test_direct_paths assert_equal "http://www.rubyonrails.org", string_path assert_equal "http://www.rubyonrails.org", Routes.url_helpers.string_path + assert_equal "http://www.example.com/basket", helper_url + assert_equal "http://www.example.com/basket", Routes.url_helpers.helper_url + assert_equal "/categories/1", linkable_path(@category) assert_equal "/categories/1", Routes.url_helpers.linkable_path(@category) assert_equal "/collections/2", linkable_path(@collection) @@ -99,6 +103,9 @@ def test_direct_urls assert_equal "http://www.rubyonrails.org", string_url assert_equal "http://www.rubyonrails.org", Routes.url_helpers.string_url + assert_equal "http://www.example.com/basket", helper_url + assert_equal "http://www.example.com/basket", Routes.url_helpers.helper_url + assert_equal "http://www.example.com/categories/1", linkable_url(@category) assert_equal "http://www.example.com/categories/1", Routes.url_helpers.linkable_url(@category) assert_equal "http://www.example.com/collections/2", linkable_url(@collection) -- GitLab