Skip to content
Extraits de code Groupes Projets
Valider 4c0dc584 rédigé par danielvincent's avatar danielvincent
Parcourir les fichiers

spec cleanup

parent 0323024f
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -7,54 +7,41 @@ ...@@ -7,54 +7,41 @@
require File.dirname(__FILE__) + '/../spec_helper' require File.dirname(__FILE__) + '/../spec_helper'
describe User do describe User do
before do let(:user) { Factory(:user) }
@user = Factory.create(:user) let(:aspect) { user.aspect(:name => 'heroes') }
@aspect = @user.aspect(:name => 'heroes')
end
describe '#diaspora_handle' do describe '#diaspora_handle' do
it 'uses the pod config url to set the diaspora_handle' do it 'uses the pod config url to set the diaspora_handle' do
@user.diaspora_handle.should == @user.username + "@example.org" user.diaspora_handle.should == user.username + "@example.org"
end end
end end
context 'profiles' do
describe 'profiles' do
it 'should be able to update their profile and send it to their friends' do it 'should be able to update their profile and send it to their friends' do
Factory.create(:person) updated_profile = { :profile => {
:first_name => 'bob',
:last_name => 'billytown',
:image_url => "http://clown.com"} }
updated_profile = {:profile => {:first_name => 'bob', :last_name => 'billytown', :image_url => "http://clown.com"}} user.update_profile(updated_profile).should be true
user.profile.image_url.should == "http://clown.com"
@user.update_profile(updated_profile).should == true
@user.profile.image_url.should == "http://clown.com"
end end
end end
describe 'aspects' do context 'aspects' do
it 'should delete an empty aspect' do let(:user2) { Factory(:user) }
@user.aspects.include?(@aspect).should == true let(:aspect2) { user2.aspect(:name => 'stuff') }
@user.drop_aspect(@aspect)
@user.reload
@user.aspects.include?(@aspect).should == false it 'should delete an empty aspect' do
user.drop_aspect(aspect)
user.aspects.include?(aspect).should == false
end end
it 'should not delete an aspect with friends' do it 'should not delete an aspect with friends' do
user2 = Factory.create(:user) friend_users(user, Aspect.find_by_id(aspect.id), user2, Aspect.find_by_id(aspect2.id))
aspect2 = user2.aspect(:name => 'stuff') aspect.reload
user2.reload proc{user.drop_aspect(aspect)}.should raise_error /Aspect not empty/
aspect2.reload user.aspects.include?(aspect).should == true
friend_users(@user, Aspect.find_by_id(@aspect.id), user2, Aspect.find_by_id(aspect2.id))
@aspect.reload
@user.aspects.include?(@aspect).should == true
proc{@user.drop_aspect(@aspect)}.should raise_error /Aspect not empty/
@user.reload
@user.aspects.include?(@aspect).should == true
end end
end end
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter