From 6a0a9459861c083659c9a3e579cc8f0a552157c8 Mon Sep 17 00:00:00 2001 From: Raphael Sofaer Date: Sat, 12 Feb 2011 13:36:38 -0800 Subject: [PATCH] Switch dispatch_post and add_to_streams --- app/controllers/status_messages_controller.rb | 2 +- spec/controllers/status_messages_controller_spec.rb | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/controllers/status_messages_controller.rb b/app/controllers/status_messages_controller.rb index 91ce37bce..831bf0978 100644 --- a/app/controllers/status_messages_controller.rb +++ b/app/controllers/status_messages_controller.rb @@ -22,8 +22,8 @@ class StatusMessagesController < ApplicationController aspects = current_user.aspects_from_ids(params[:aspect_ids]) if @status_message.save - current_user.dispatch_post(@status_message, :url => post_url(@status_message)) current_user.add_to_streams(@status_message, aspects) + current_user.dispatch_post(@status_message, :url => post_url(@status_message)) if !photos.empty? @status_message.photos += photos for photo in photos diff --git a/spec/controllers/status_messages_controller_spec.rb b/spec/controllers/status_messages_controller_spec.rb index 7d5ad293a..09ec97ce3 100644 --- a/spec/controllers/status_messages_controller_spec.rb +++ b/spec/controllers/status_messages_controller_spec.rb @@ -78,6 +78,13 @@ describe StatusMessagesController do old_status_message.reload.message.should == 'hello' end + it 'calls dispatch post once subscribers is set' do + @user1.should_receive(:dispatch_post){|post, opts| + post.subscribers(@user1).should == [@user2.person] + } + post :create, status_message_hash + end + context 'with photos' do before do fixture_filename = 'button.png'