class ToParamTest
Public Instance Methods
test_array()
click to toggle source
# File activesupport/test/core_ext/object/to_param_test.rb, line 28 def test_array # Empty Array assert_equal "", [].to_param array = [1, 2, 3, 4] assert_equal "1/2/3/4", array.to_param # Array of different objects array = [1, "3", { a: 1, b: 2 }, nil, true, false, CustomString.new("object")] assert_equal "1/3/a=1&b=2//true/false/custom-object", array.to_param end
test_boolean()
click to toggle source
# File activesupport/test/core_ext/object/to_param_test.rb, line 23 def test_boolean assert_equal true, true.to_param assert_equal false, false.to_param end
test_nil()
click to toggle source
# File activesupport/test/core_ext/object/to_param_test.rb, line 19 def test_nil assert_nil nil.to_param end
test_object()
click to toggle source
# File activesupport/test/core_ext/object/to_param_test.rb, line 13 def test_object foo = Object.new def foo.to_s; "foo" end assert_equal "foo", foo.to_param end