Refactor user_spec a little
This commit is contained in:
parent
fe1a6bce20
commit
41cfd36b19
1 changed files with 8 additions and 20 deletions
|
|
@ -9,8 +9,6 @@ describe User do
|
|||
let(:aspect) { user.aspect(:name => 'heroes') }
|
||||
let(:user2) { Factory(:user) }
|
||||
let(:aspect2) { user2.aspect(:name => 'stuff') }
|
||||
let(:user3) { Factory(:user) }
|
||||
let(:aspect3) { user3.aspect(:name => 'stuff') }
|
||||
|
||||
describe "validation" do
|
||||
describe "of associated person" do
|
||||
|
|
@ -168,12 +166,7 @@ describe User do
|
|||
end
|
||||
end
|
||||
|
||||
context 'account removal' do
|
||||
before do
|
||||
friend_users(user, aspect, user2, aspect2)
|
||||
friend_users(user, aspect, user3, aspect3)
|
||||
end
|
||||
|
||||
describe 'account removal' do
|
||||
it 'should unfriend everyone' do
|
||||
user.should_receive(:unfriend_everyone)
|
||||
user.destroy
|
||||
|
|
@ -185,11 +178,8 @@ describe User do
|
|||
end
|
||||
|
||||
it 'should remove all aspects' do
|
||||
aspects = user.aspects
|
||||
aspects.count.should > 0
|
||||
user.destroy
|
||||
aspects.reload
|
||||
aspects.count.should == 0
|
||||
aspect
|
||||
lambda {user.destroy}.should change{user.aspects.reload.count}.by(-1)
|
||||
end
|
||||
|
||||
describe '#remove_person' do
|
||||
|
|
@ -209,20 +199,18 @@ describe User do
|
|||
end
|
||||
|
||||
describe '#unfriend_everyone' do
|
||||
before do
|
||||
user3.delete
|
||||
end
|
||||
|
||||
it 'should send retractions to remote poeple' do
|
||||
user2.delete
|
||||
user.activate_friend(user2.person, aspect)
|
||||
|
||||
user.should_receive(:unfriend).once
|
||||
user.destroy
|
||||
end
|
||||
|
||||
it 'should unfriend local people' do
|
||||
user2.friends.count.should be 1
|
||||
user.destroy
|
||||
user2.reload
|
||||
user2.friends.count.should be 0
|
||||
friend_users(user, aspect, user2, aspect2)
|
||||
lambda {user.destroy}.should change{user2.reload.friends.count}.by(-1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue