diff options
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/integration_test.rb | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/activerecord/test/cases/integration_test.rb b/activerecord/test/cases/integration_test.rb index 1f62433ea2..8097f6e36e 100644 --- a/activerecord/test/cases/integration_test.rb +++ b/activerecord/test/cases/integration_test.rb @@ -28,7 +28,19 @@ class IntegrationTest < ActiveRecord::TestCase assert_equal '4-flamboyant-software', firm.to_param end - def to_param_class_method_uses_default_if_blank + def test_to_param_class_method_truncates + firm = Firm.find(4) + firm.name = 'a ' * 100 + assert_equal '4-a-a-a-a-a-a-a-a-a', firm.to_param + end + + def test_to_param_class_method_squishes + firm = Firm.find(4) + firm.name = "ab \n" * 100 + assert_equal '4-ab-ab-ab-ab-ab-ab', firm.to_param + end + + def test_to_param_class_method_uses_default_if_blank firm = Firm.find(4) firm.name = nil assert_equal '4', firm.to_param @@ -36,11 +48,15 @@ class IntegrationTest < ActiveRecord::TestCase assert_equal '4', firm.to_param end - def to_param_class_method_uses_default_if_not_persisted + def test_to_param_class_method_uses_default_if_not_persisted firm = Firm.new(name: 'Fancy Shirts') assert_equal nil, firm.to_param end + def test_to_param_with_no_arguments + assert_equal 'Firm', Firm.to_param + end + def test_cache_key_for_existing_record_is_not_timezone_dependent utc_key = Developer.first.cache_key |