Permalink
Browse files

Regression test for #7238

  • Loading branch information...
1 parent 8f3f50a commit 8424d0dda3a991b735365e993d907827a1913480 @nikitug nikitug committed Nov 13, 2012
Showing with 13 additions and 0 deletions.
  1. +7 −0 activerecord/test/cases/finder_test.rb
  2. +6 −0 activerecord/test/models/topic.rb
@@ -610,6 +610,13 @@ def test_find_by_one_attribute_that_is_an_alias
assert_nil Topic.find_by_heading("The First Topic!")
end
+ def test_find_by_one_attribute_bang_with_blank_defined
+ BlankTopic.create(title: "The Blank One")
+ assert_nothing_raised do
+ BlankTopic.find_by_title!("The Blank One")
+ end
+ end
+
def test_find_by_one_attribute_with_conditions
assert_equal accounts(:rails_core_account), Account.where('firm_id = ?', 6).find_by_credit_limit(50)
end
@@ -107,6 +107,12 @@ class ImportantTopic < Topic
serialize :important, Hash
end
+class BlankTopic < Topic
+ def blank?
+ true
+ end
+end
+
module Web
class Topic < ActiveRecord::Base
has_many :replies, :dependent => :destroy, :foreign_key => "parent_id", :class_name => 'Web::Reply'

0 comments on commit 8424d0d

Please sign in to comment.