1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Add test for calling a url helper in Mapper#direct

This commit is contained in:
Andrew White 2017-02-20 14:37:00 +00:00
parent 7d1e738057
commit d67e252028

View file

@ -32,6 +32,7 @@ class TestCustomUrlHelpers < ActionDispatch::IntegrationTest
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 @@ class TestCustomUrlHelpers < ActionDispatch::IntegrationTest
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 @@ class TestCustomUrlHelpers < ActionDispatch::IntegrationTest
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)