Browse files

add passing test to ensure that searchlogic plays nice with find_or_c…

…reate_by_* activerecord methods.
  • Loading branch information...
1 parent 0c58b28 commit bdedddefadc9cf1f986811db9dae4f47ad8bcce8 John Dell committed with Nov 12, 2009
Showing with 12 additions and 1 deletion.
  1. +12 −1 spec/named_scopes/or_conditions_spec.rb
View
13 spec/named_scopes/or_conditions_spec.rb
@@ -50,4 +50,15 @@
User.company_conglomerate_name_or_company_conglomerate_description_like("ben").proxy_options.should ==
{:joins =>[{:company, :conglomerate}], :conditions => "(conglomerates.name LIKE '%ben%') OR (conglomerates.description LIKE '%ben%')"}
end
-end
+
+ it "should not get confused by the 'or' in find_or_create_by_* methods" do
+ User.create(:name => "Fred")
+ User.find_or_create_by_name("Fred").should be_a_kind_of User
+ end
+
+ it "should not get confused by the 'or' in compound find_or_create_by_* methods" do
+ User.create(:name => "Fred", :username => "fredb")
+ User.find_or_create_by_name_and_username("Fred", "fredb").should be_a_kind_of User
+ end
+
+end

0 comments on commit bdeddde

Please sign in to comment.