Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Regression test for #7238 #8202

Merged
merged 1 commit into from Nov 13, 2012
Jump to file or symbol
Failed to load files and symbols.
+13 −0
Split
@@ -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")
@spastorino

spastorino Nov 13, 2012

Owner

Not a fan of assert_nothing_raised seems much better to me to test the result of the query ❤️

+ 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'