Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/aspect_spec.rb')
-rw-r--r--spec/models/aspect_spec.rb117
1 files changed, 0 insertions, 117 deletions
diff --git a/spec/models/aspect_spec.rb b/spec/models/aspect_spec.rb
index b0acb9455..66377aaed 100644
--- a/spec/models/aspect_spec.rb
+++ b/spec/models/aspect_spec.rb
@@ -18,9 +18,6 @@ describe Aspect do
describe 'creation' do
let!(:aspect){user.aspects.create(:name => 'losers')}
- it 'has a name' do
- aspect.name.should == "losers"
- end
it 'does not allow duplicate names' do
lambda {
@@ -46,14 +43,6 @@ describe Aspect do
aspect.contacts.size.should == 1
end
- it 'is able to have users and people and contacts' do
- contact1 = Contact.create(:user => user, :person => user2.person, :aspects => [aspect])
- contact2 = Contact.create(:user => user, :person => connected_person_2, :aspects => [aspect])
- aspect.contacts.include?(contact1).should be_true
- aspect.contacts.include?(contact2).should be_true
- aspect.save.should be_true
- end
-
it 'has a contacts_visible? method' do
aspect.contacts_visible?.should be_true
end
@@ -71,110 +60,4 @@ describe Aspect do
aspect2.should be_valid
end
end
-
- describe 'querying' do
- before do
- aspect
- user.activate_contact(connected_person, aspect)
- end
-
- it 'belong to a user' do
- aspect.user.id.should == user.id
- user.aspects.should == [aspect]
- end
-
- it 'should have contacts' do
- aspect.contacts.size.should == 2
- end
-
- describe '#aspects_with_person' do
- let!(:aspect_without_contact) {user.aspects.create(:name => "Another aspect")}
- it 'should return the aspects with given contact' do
- user.reload
- aspects = user.aspects_with_person(connected_person)
- aspects.size.should == 1
- aspects.first.should == aspect
- end
-
- it 'returns multiple aspects if the person is there' do
- user.reload
- contact = user.contact_for(connected_person)
- user.add_contact_to_aspect(contact, aspect1)
- aspects = user.aspects_with_person(connected_person)
- aspects.count.should == 2
- aspects.each{ |asp| asp.contacts.include?(contact).should be_true }
- aspects.include?(aspect_without_contact).should be_false
- end
- end
- end
-
- describe 'posting' do
-
- it 'should add post to aspect via post method' do
- aspect = user.aspects.create(:name => 'losers')
- contact = aspect.contacts.create(:person => connected_person)
-
- status_message = user.post(:status_message, :text => "hey", :to => aspect.id)
-
- aspect.reload
- aspect.posts.include?(status_message).should be true
- end
-
- end
-
- context "aspect management" do
- before do
- connect_users(user, aspect, user2, aspect2)
- aspect.reload
- user.reload
- @contact = user.contact_for(user2.person)
- end
-
-
- describe "#add_contact_to_aspect" do
- it 'adds the contact to the aspect' do
- aspect1.contacts.include?(@contact).should be_false
- user.add_contact_to_aspect(@contact, aspect1)
- aspect1.reload
- aspect1.contacts.include?(@contact).should be_true
- end
-
- it 'returns true if they are already in the aspect' do
- user.add_contact_to_aspect(@contact, aspect).should == true
- end
- end
- context 'moving and removing posts' do
- before do
- @message = user2.post(:status_message, :text => "Hey Dude", :to => aspect2.id)
- aspect.reload
- user.reload
- end
-
- describe 'User#move_contact' do
- it 'should be able to move a contact from one of users existing aspects to another' do
- user.move_contact(user2.person, aspect1, aspect)
-
- aspect.contacts(true).include?(@contact).should be_false
- aspect1.contacts(true).include?(@contact).should be_true
- end
-
- it "should not move a person who is not a contact" do
- proc{
- user.move_contact(connected_person, aspect1, aspect)
- }.should raise_error
-
- aspect.reload
- aspect1.reload
- aspect.contacts.where(:person_id => connected_person.id).should be_empty
- aspect1.contacts.where(:person_id => connected_person.id).should be_empty
- end
-
- it 'does not try to delete if add person did not go through' do
- user.should_receive(:add_contact_to_aspect).and_return(false)
- user.should_not_receive(:delete_person_from_aspect)
- user.move_contact(user2.person, aspect1, aspect)
- end
- end
- end
- end
end