aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/object
diff options
context:
space:
mode:
authorAkshay Vishnoi <akshay.vishnoi@vinsol.com>2014-07-29 20:05:36 +0530
committerAkshay Vishnoi <akshay.vishnoi@vinsol.com>2014-07-29 20:05:36 +0530
commit6bc7e27c191b76015b21c22c31da38593bd6f367 (patch)
tree9cad28c4719e9b18ad11ebacb37042ac6d9bbc51 /activesupport/test/core_ext/object
parent8426897086a3ad08cc7280d7af26cb5ccf352922 (diff)
downloadrails-6bc7e27c191b76015b21c22c31da38593bd6f367.tar.gz
rails-6bc7e27c191b76015b21c22c31da38593bd6f367.tar.bz2
rails-6bc7e27c191b76015b21c22c31da38593bd6f367.zip
Add missing test case for Array#to_sentence, collect all test cases for Object#to_param at one place and avoid repitition
Diffstat (limited to 'activesupport/test/core_ext/object')
-rw-r--r--activesupport/test/core_ext/object/to_param_test.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/activesupport/test/core_ext/object/to_param_test.rb b/activesupport/test/core_ext/object/to_param_test.rb
index 25c3bf22c3..30a7557dc2 100644
--- a/activesupport/test/core_ext/object/to_param_test.rb
+++ b/activesupport/test/core_ext/object/to_param_test.rb
@@ -2,6 +2,12 @@ require 'abstract_unit'
require 'active_support/core_ext/object/to_param'
class ToParamTest < ActiveSupport::TestCase
+ class CustomString < String
+ def to_param
+ "custom-#{ self }"
+ end
+ end
+
def test_object
foo = Object.new
def foo.to_s; 'foo' end
@@ -25,7 +31,7 @@ class ToParamTest < ActiveSupport::TestCase
assert_equal "1/2/3/4", array.to_param
# Array of different objects
- array = [1, '3', { a: 1, b: 2 }, nil, true, false]
- assert_equal "1/3/a=1&b=2//true/false", array.to_param
+ 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
end