forgot to add the test; and cleaned up the explain partial

This commit is contained in:
maxwell 2010-10-15 16:19:07 -07:00
parent a0ce9630b1
commit f83bddadc5
2 changed files with 39 additions and 2 deletions

View file

@ -1,12 +1,12 @@
%h3 You are about to post a public message!
%p
Public messages will be available for others outside of Diaspora to see.
%br
%br
- if @logged_in
= connected_fb_as(@access_token)
- else
= link_to "Connect to Facebook", @fb_access_url
%br
%br
= link_to "OK", '#', :class => "button", :onClick => '$.fancybox.close();'

View file

@ -0,0 +1,37 @@
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
require 'spec_helper'
describe StatusMessagesController do
render_views
before do
@user = Factory.create(:user)
@aspect = @user.aspect(:name => "lame-os")
@album = @user.post :album, :to => @aspect.id, :name => 'things on fire'
sign_in :user, @user
end
describe '#create' do
let(:status_message_hash) {{"aspect_ids" =>"#{@aspect.id.to_s}", "status_message"=>{"public"=>"1", "message"=>"facebook, is that you?"}}}
before do
@controller.stub!(:logged_into_fb?).and_return(true)
end
it 'should post to facebook when public is set' do
my_mock = mock("http")
my_mock.stub!(:post)
EventMachine::HttpRequest.should_receive(:new).and_return(my_mock)
post :create, status_message_hash
end
it 'should not post to facebook when public in not set' do
status_message_hash['status_message']['public'] = '0'
EventMachine::HttpRequest.should_not_receive(:new)
post :create, status_message_hash
end
end
end