Fix 1.9 build. Apparently mongo mapper in 1.9 does not like contacts(:pending => false) - it has to be contacts.where(:pending => false). And now you know.

This commit is contained in:
Sarah Mei 2010-12-20 02:50:38 -08:00
parent 850dcfd322
commit c1bfbd358e
4 changed files with 32 additions and 3 deletions

View file

@ -59,7 +59,7 @@ class AspectsController < ApplicationController
def show
@aspect = current_user.aspect_by_id params[:id]
@contacts = current_user.contacts(:pending => false)
@contacts = current_user.contacts.where(:pending => false)
unless @aspect
render :file => "#{Rails.root}/public/404.html", :layout => false, :status => 404
else
@ -78,7 +78,7 @@ class AspectsController < ApplicationController
def manage
@aspect = :manage
@contacts = current_user.contacts(:pending => false)
@contacts = current_user.contacts.where(:pending => false)
@remote_requests = Request.hashes_for_person(current_user.person)
@aspect_hashes = hashes_for_aspects @aspects, @contacts
end

View file

@ -299,7 +299,7 @@ class User
params[:image_url_small] = params[:photo].url(:thumb_small)
end
if self.person.profile.update_attributes(params)
push_to_people profile, self.person_objects(contacts(:pending => false))
push_to_people profile, self.person_objects(contacts.where(:pending => false))
true
else
false

View file

@ -72,6 +72,16 @@ describe AspectsController do
assigns(:aspect_contacts).first[:person].should == achash[:person]
assigns(:posts).should == []
end
it "assigns contacts to only non-pending" do
@user.contacts.count.should == 1
@user.send_contact_request_to(make_user.person, @aspect)
@user.contacts.count.should == 2
get :show, 'id' => @aspect.id.to_s
contacts = assigns(:contacts)
contacts.count.should == 1
contacts.first.should == @contact
end
it "paginates" do
16.times { |i| @user2.post(:status_message, :to => @aspect2.id, :message => "hi #{i}") }
@ -121,6 +131,16 @@ describe AspectsController do
get :manage
assigns(:remote_requests).should be_empty
end
it "assigns contacts to only non-pending" do
@user.contacts.count.should == 1
@user.send_contact_request_to(make_user.person, @aspect)
@user.contacts.count.should == 2
get :manage
contacts = assigns(:contacts)
contacts.count.should == 1
contacts.first.should == @contact
end
context "when the user has pending requests" do
before do
requestor = make_user

View file

@ -262,6 +262,15 @@ describe User do
user.update_profile(params).should be_true
user.reload.profile.image_url.should == "http://clown.com"
end
it "only pushes to non-pending contacts" do
connect_users(user, aspect, user2, aspect2)
user.contacts.count.should == 1
user.send_contact_request_to(make_user.person, aspect)
user.contacts.count.should == 2
user.should_receive(:push_to_person).once
user.update_profile(@params).should be_true
end
context 'passing in a photo' do
before do
fixture_filename = 'button.png'