diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-05-02 06:59:52 -0700 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-05-02 06:59:52 -0700 |
commit | ca2bc303a9764f23aa1b610c6b06cadbb23d5408 (patch) | |
tree | d458f137f032edd2cf70768b129fc3740c0b55af | |
parent | eee91eb77e3b04ffbdc6e1e05802772f29c2fa49 (diff) | |
parent | ec0566cc91601b45e77d256cbf0cad632a81ec49 (diff) | |
download | rails-ca2bc303a9764f23aa1b610c6b06cadbb23d5408.tar.gz rails-ca2bc303a9764f23aa1b610c6b06cadbb23d5408.tar.bz2 rails-ca2bc303a9764f23aa1b610c6b06cadbb23d5408.zip |
Merge pull request #10416 from tkhr/add-test-for-AR--Base#to_param
Add test for `AR::Base#to_param`
-rw-r--r-- | activerecord/test/cases/integration_test.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/activerecord/test/cases/integration_test.rb b/activerecord/test/cases/integration_test.rb index 7fbde4e2f9..b0a7cda2f3 100644 --- a/activerecord/test/cases/integration_test.rb +++ b/activerecord/test/cases/integration_test.rb @@ -11,7 +11,12 @@ class IntegrationTest < ActiveRecord::TestCase assert_kind_of String, Client.first.to_param end - def test_to_param_returns_id_even_if_not_persisted + def test_to_param_returns_nil_if_not_persisted + client = Client.new + assert_equal nil, client.to_param + end + + def test_to_param_returns_id_if_not_persisted_but_id_is_set client = Client.new client.id = 1 assert_equal '1', client.to_param |