From 03a0031ddd50c9a952c5f812ef99b42d0fdcbc75 Mon Sep 17 00:00:00 2001 From: Sarah Mei Date: Fri, 8 Oct 2010 00:38:53 -0600 Subject: [PATCH 1/4] .gitignore capybara output --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 571cd38ae..537c0fae2 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ gpg/*/random_seed public/uploads/* public/source.tar tmp/**/* +capybara-*.html \ No newline at end of file From c0bf7ab5cd4995a362bab29bd787278e730fabb9 Mon Sep 17 00:00:00 2001 From: Sarah Mei Date: Fri, 8 Oct 2010 00:39:30 -0600 Subject: [PATCH 2/4] Rake task for CI that includes a bundle install --- lib/tasks/ci.rake | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 lib/tasks/ci.rake diff --git a/lib/tasks/ci.rake b/lib/tasks/ci.rake new file mode 100644 index 000000000..2bd2dddaa --- /dev/null +++ b/lib/tasks/ci.rake @@ -0,0 +1,5 @@ +desc "Run all specs and features" +task :ci => [:environment] do + system "bundle install" + system "bundle exec rake" +end \ No newline at end of file From b02e266130601dab260bbd8f931a4302efc99bac Mon Sep 17 00:00:00 2001 From: Sarah Mei Date: Fri, 8 Oct 2010 01:07:07 -0600 Subject: [PATCH 3/4] Don't need a bundle install in the ci task --- lib/tasks/ci.rake | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/tasks/ci.rake b/lib/tasks/ci.rake index 2bd2dddaa..070a314f3 100644 --- a/lib/tasks/ci.rake +++ b/lib/tasks/ci.rake @@ -1,5 +1,4 @@ desc "Run all specs and features" task :ci => [:environment] do - system "bundle install" system "bundle exec rake" end \ No newline at end of file From 511cd8fa1c252650faacb72b792cea5a4a81469e Mon Sep 17 00:00:00 2001 From: Sarah Mei Date: Fri, 8 Oct 2010 01:23:33 -0600 Subject: [PATCH 4/4] Clean up reloading in user friending spec. --- spec/models/user/user_friending_spec.rb | 90 ++++++++++++------------- 1 file changed, 43 insertions(+), 47 deletions(-) diff --git a/spec/models/user/user_friending_spec.rb b/spec/models/user/user_friending_spec.rb index e72409d52..c882453c6 100644 --- a/spec/models/user/user_friending_spec.rb +++ b/spec/models/user/user_friending_spec.rb @@ -5,10 +5,10 @@ require 'spec_helper' describe User do - before do - @user = Factory.create(:user) - @aspect = @user.aspect(:name => 'heroes') - end + before do + @user = Factory.create(:user) + @aspect = @user.aspect(:name => 'heroes') + end describe 'friend requesting' do it "should assign a request to a aspect" do @@ -22,7 +22,7 @@ describe User do aspect.requests.size.should == 1 end - it "should be able to accept a pending friend request" do + it "should be able to accept a pending friend request" do friend = Factory.create(:person) r = Request.instantiate(:to => @user.receive_url, :from => friend) r.save @@ -45,12 +45,13 @@ describe User do Request.count.should == 0 end - it 'should not be able to friend request an existing friend' do friend = Factory.create(:person) + it 'should not be able to friend request an existing friend' do + friend = Factory.create(:person) @user.friends << friend @user.save - proc {@user.send_friend_request_to( friend, @aspect)}.should raise_error + proc { @user.send_friend_request_to(friend, @aspect) }.should raise_error end describe 'multiple users accepting/rejecting the same person' do @@ -133,7 +134,7 @@ describe User do @user2.receive @req_two_xml @user2.pending_requests.size.should be 1 - @user2.ignore_friend_request @user2.pending_requests.first.id#@request_two.id + @user2.ignore_friend_request @user2.pending_requests.first.id #@request_two.id @user2.friends.include?(@person_one).should be false Person.all.count.should be 3 end @@ -177,51 +178,46 @@ describe User do end - describe 'unfriending' do - before do - @user2 = Factory.create :user - @aspect2 = @user2.aspect(:name => "Gross people") - - friend_users(@user, @aspect, @user2, @aspect2) - @user.reload - @user2.reload - @aspect.reload - @aspect2.reload - end - - it 'should unfriend the other user on the same seed' do - @user.friends.count.should == 1 - @user2.friends.count.should == 1 - - @user2.unfriend @user.person - @user2.friends.count.should be 0 - - @user.unfriended_by @user2.person - - @aspect.reload - @aspect2.reload - @aspect.people.count.should == 0 - @aspect2.people.count.should == 0 - end - context 'with a post' do + describe 'unfriending' do before do - @message = @user.post(:status_message, :message => "hi", :to => @aspect.id) - @user2.receive @message.to_diaspora_xml.to_s - @user2.unfriend @user.person - @user.unfriended_by @user2.person - @aspect.reload - @aspect2.reload + @user2 = Factory.create :user + @aspect2 = @user2.aspect(:name => "Gross people") + + friend_users(@user, @aspect, @user2, @aspect2) @user.reload @user2.reload + @aspect.reload + @aspect2.reload end - it "deletes the unfriended user's posts from visible_posts" do - @user.raw_visible_posts.include?(@message.id).should be_false + + it 'should unfriend the other user on the same seed' do + @user.friends.count.should == 1 + @user2.friends.count.should == 1 + + @user2.unfriend @user.person + @user2.friends.count.should be 0 + + @user.unfriended_by @user2.person + + @aspect.reload + @aspect2.reload + @aspect.people.count.should == 0 + @aspect2.people.count.should == 0 end - it "deletes the unfriended user's posts from the aspect's posts" do - @aspect2.posts.include?(@message).should be_false + context 'with a post' do + before do + @message = @user.post(:status_message, :message => "hi", :to => @aspect.id) + @user2.receive @message.to_diaspora_xml.to_s + @user2.unfriend @user.person + @user.unfriended_by @user2.person + end + it "deletes the unfriended user's posts from visible_posts" do + @user.raw_visible_posts(true).include?(@message.id).should be_false + end + it "deletes the unfriended user's posts from the aspect's posts" do + @aspect2.posts(true).include?(@message).should be_false + end end end end - - end end