From 6dc35c516a5c42138e6b89e25611d35c22872321 Mon Sep 17 00:00:00 2001 From: zhitomirskiyi Date: Fri, 18 Feb 2011 13:15:32 -0800 Subject: [PATCH] added two pending specs for mnutt --- spec/intergration/receiving_spec.rb | 19 +++++++++++++++++++ spec/models/mention_spec.rb | 18 ++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/spec/intergration/receiving_spec.rb b/spec/intergration/receiving_spec.rb index 7c89021a6..18bb5d775 100644 --- a/spec/intergration/receiving_spec.rb +++ b/spec/intergration/receiving_spec.rb @@ -55,6 +55,25 @@ describe 'a user receives a post' do @user1.aspects.size.should == num_aspects end + context 'mentions' do + it 'adds the notifications for the mentioned users reguardless of the order they are received' do + pending 'this is for mnutt' + Notification.should_receive(:notify).with(@user1, anything(), @user2.person) + Notification.should_receive(:notify).with(@user3, anything(), @user2.person) + + @sm = @user2.build_post(:status_message, :message => "@{#{@user1.name}; #{@user1.diaspora_handle}} stuff @{#{@user3.name}; #{@user3.diaspora_handle}}") + @sm.stub!(:socket_to_user) + @user2.add_to_streams(@sm, [@user2.aspects.first]) + @sm.save + + zord = Postzord::Receiver.new(@user1, :object => @sm, :person => @user2.person) + zord.receive_object + + zord = Postzord::Receiver.new(@user3, :object => @sm, :person => @user2.person) + zord.receive_object + end + end + context 'update posts' do it 'does not update posts not marked as mutable' do status = @user1.post :status_message, :message => "store this!", :to => @aspect.id diff --git a/spec/models/mention_spec.rb b/spec/models/mention_spec.rb index bd72f778b..e16f68eff 100644 --- a/spec/models/mention_spec.rb +++ b/spec/models/mention_spec.rb @@ -8,6 +8,10 @@ describe Mention do describe 'before create' do before do @user = alice + @aspect1 = @user.aspects.create(:name => 'second_aspect') + @mentioned_user = bob + @non_friend = eve + @sm = Factory(:status_message) @m = Mention.new(:person => @user.person, :post=> @sm) @@ -22,6 +26,20 @@ describe Mention do Notification.should_not_receive(:notify) m.save end + + it 'should not notify a user if they do not see the message' do + pending "this is for mnutt" + connect_users(@user, @aspect1, @non_friend, @non_friend.aspects.first) + + Notification.should_not_receive(:notify).with(@mentioned_user, anything(), @user.person) + sm2 = @user.build_post(:status_message, :message => 'stuff') + sm2.stub!(:socket_to_user) + @user.add_to_streams(sm2, [@aspect1]) + m2 = Mention.new(:person => @mentioned_user.person, :post => @sm) + sm2.save + m2.save + end + end describe '#notification_type' do