Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…reate_by_* activerecord methods.
  • Loading branch information...
commit bdedddefadc9cf1f986811db9dae4f47ad8bcce8 1 parent 0c58b28
John Dell authored committed
Showing with 12 additions and 1 deletion.
  1. +12 −1 spec/named_scopes/or_conditions_spec.rb
13 spec/named_scopes/or_conditions_spec.rb
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.