Newer
Older
# licensed under the Affero General Public License version 3 or later. See
Daniel Vincent Grippi
a validé
User.count.should_not == 0
describe '#connect_users' do
@user1 = User.where(:username => 'alice').first
@user2 = User.where(:username => 'eve').first
@aspect1 = @user1.aspects.first
@aspect2 = @user2.aspects.first
connect_users(@user1, @aspect1, @user2, @aspect2)
it 'connects the first user to the second' do
contact = @user1.contact_for @user2.person
@user1.contacts.reload.include?(contact).should be_true
danielvincent
a validé
@aspect1.contacts.include?(contact).should be_true
contact.aspects.include?(@aspect1).should be_true
it 'connects the second user to the first' do
contact = @user2.contact_for @user1.person
@user2.contacts.reload.include?(contact).should be_true
danielvincent
a validé
@aspect2.contacts.include?(contact).should be_true
contact.aspects.include?(@aspect2).should be_true
danielvincent
a validé
it 'allows posting after running' do
message = @user1.post(:status_message, :message => "Connection!", :to => @aspect1.id)
danielvincent
a validé
@user2.reload.visible_posts.should include message
end
describe '#comment' do
it "should send a user's comment on a person's post to that person" do
person = Factory.create(:person)
person_status = Factory.create(:status_message, :author => person)
m = mock()
m.stub!(:post)
Postzord::Dispatch.should_receive(:new).and_return(m)
alice.comment "yo", :on => person_status
end
end