aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/finder_test.rb
diff options
context:
space:
mode:
authorFranck Verrot <franck@verrot.fr>2010-11-13 06:29:30 +0800
committerJosé Valim <jose.valim@gmail.com>2010-11-13 06:32:08 +0800
commit983976ec5484b92d1b46305a2e3bd59bf98a3853 (patch)
treec3bfbdba0b7fcd3d96c1b653fff6735672c7c79d /activerecord/test/cases/finder_test.rb
parentb15d816166c64894bfe33860f4949772c8806f2f (diff)
downloadrails-983976ec5484b92d1b46305a2e3bd59bf98a3853.tar.gz
rails-983976ec5484b92d1b46305a2e3bd59bf98a3853.tar.bz2
rails-983976ec5484b92d1b46305a2e3bd59bf98a3853.zip
Finder gives a little bit more info on the lookup column (primary key)
Diffstat (limited to 'activerecord/test/cases/finder_test.rb')
-rw-r--r--activerecord/test/cases/finder_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb
index 87ec999b03..39ce47d9d6 100644
--- a/activerecord/test/cases/finder_test.rb
+++ b/activerecord/test/cases/finder_test.rb
@@ -10,6 +10,7 @@ require 'models/entrant'
require 'models/project'
require 'models/developer'
require 'models/customer'
+require 'models/toy'
class FinderTest < ActiveRecord::TestCase
fixtures :companies, :topics, :entrants, :developers, :developers_projects, :posts, :comments, :accounts, :authors, :customers, :categories, :categorizations
@@ -1010,6 +1011,15 @@ class FinderTest < ActiveRecord::TestCase
end
end
+ def test_find_one_message_with_custom_primary_key
+ Toy.set_primary_key :name
+ begin
+ Toy.find 'Hello World!'
+ rescue ActiveRecord::RecordNotFound => e
+ assert_equal 'Couldn\'t find Toy with name=Hello World!', e.message
+ end
+ end
+
protected
def bind(statement, *vars)
if vars.first.is_a?(Hash)