提交 d67e2520 编写于 作者: A Andrew White

Add test for calling a url helper in Mapper#direct

上级 7d1e7380
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册