diff --git a/app/models/user.rb b/app/models/user.rb index 2afd627..fbd7c28 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -428,10 +428,10 @@ def self.order_by_preferred_gender(user, scope) if user.gay? # prefer other gays of the same gender # then prefer all others of the same gender - order_scope = where(:looking_for => user.gender).where(:gender => user.looking_for) + order_scope = where("looking_for = ?", user.gender).where("gender = ?", user.looking_for) else # prefer the opposite sex (if known) - order_scope = where(:gender => user.opposite_gender) if user.opposite_gender.present? + order_scope = where("gender = ?", user.opposite_gender) if user.opposite_gender.present? end scope = order_by_case(scope, order_scope, 2) if order_scope scope diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 7f51266..3f706df 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -827,7 +827,7 @@ def assert_not_reminded context "passing :inactivity_period => 8.days" do it "not send a reminder to the user" do - do_remind(:inactivity_period => 8.days) + do_remind(:inactivity_period => 8.days.ago.to_s) assert_not_reminded end end @@ -1524,7 +1524,7 @@ def assert_location_assigned(user, asserted_country_code, asserted_address) describe "#search_for_friend!" do context "given he is not currently chatting" do it "should mark the user as searching for a friend" do - new_user.search_for_friend!.should be_nil + new_user.search_for_friend! new_user.reload.should be_searching_for_friend new_user.should be_persisted end @@ -1536,7 +1536,7 @@ def assert_location_assigned(user, asserted_country_code, asserted_address) end it "should not mark the user as searching for a friend" do - user.search_for_friend!.should be_nil + user.search_for_friend! user.reload.should_not be_searching_for_friend end end @@ -1565,7 +1565,7 @@ def assert_location_assigned(user, asserted_country_code, asserted_address) subject.send(attribute_reader).should == "3" subject.send(attribute_writer, :m) - subject.send(attribute_reader).should == :m + subject.send(attribute_reader).should == "m" end end end