diff --git a/app/controllers/status_messages_controller.rb b/app/controllers/status_messages_controller.rb index 726835961..21c72711b 100644 --- a/app/controllers/status_messages_controller.rb +++ b/app/controllers/status_messages_controller.rb @@ -43,6 +43,9 @@ class StatusMessagesController < ApplicationController def create params[:status_message][:aspect_ids] = [*params[:aspect_ids]] normalize_public_flag! + + # ensure services is an array since .map doesn't work on a string for ruby 1.9 + params[:services] = [params[:services]] if params[:services].is_a?(String) @status_message = current_user.build_post(:status_message, params[:status_message]) diff --git a/spec/controllers/status_messages_controller_spec.rb b/spec/controllers/status_messages_controller_spec.rb index c851d9acd..e7e9ef7de 100644 --- a/spec/controllers/status_messages_controller_spec.rb +++ b/spec/controllers/status_messages_controller_spec.rb @@ -72,6 +72,14 @@ describe StatusMessagesController do post :create, status_message_hash end + it "works if services is a string" do + s1 = Services::Facebook.new + alice.services << s1 + status_message_hash[:services] = "facebook" + alice.should_receive(:dispatch_post).with(anything(), hash_including(:services => [s1])) + post :create, status_message_hash + end + it "doesn't overwrite author_id" do status_message_hash[:status_message][:author_id] = bob.person.id post :create, status_message_hash