removing traces of bookmarks and blogs from specs
This commit is contained in:
parent
29ecd53361
commit
9ee10450c4
2 changed files with 59 additions and 57 deletions
|
|
@ -9,7 +9,6 @@ describe Person do
|
||||||
@group2 = @user2.group(:name => "Abscence of Babes")
|
@group2 = @user2.group(:name => "Abscence of Babes")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
it 'should not allow two people with the same email' do
|
it 'should not allow two people with the same email' do
|
||||||
person_two = Factory.build(:person, :url => @person.email)
|
person_two = Factory.build(:person, :url => @person.email)
|
||||||
person_two.valid?.should == false
|
person_two.valid?.should == false
|
||||||
|
|
@ -19,12 +18,13 @@ describe Person do
|
||||||
before do
|
before do
|
||||||
@xml = @person.to_xml.to_s
|
@xml = @person.to_xml.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should serialize to xml' do
|
it 'should serialize to xml' do
|
||||||
(@xml.include? "person").should == true
|
@xml.include?("person").should == true
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should have a profile in its xml' do
|
it 'should have a profile in its xml' do
|
||||||
(@xml.include? "first_name").should == true
|
@xml.include?("first_name").should == true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -32,34 +32,34 @@ describe Person do
|
||||||
person_message = Factory.create(:status_message, :person => @person)
|
person_message = Factory.create(:status_message, :person => @person)
|
||||||
person_two = Factory.create(:person)
|
person_two = Factory.create(:person)
|
||||||
|
|
||||||
@person.owns?(person_message).should be true
|
@person.owns? (person_message).should be true
|
||||||
person_two.owns?(person_message).should be false
|
person_two.owns?(person_message).should be false
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should delete all of user except comments upon user deletion' do
|
it 'should delete all of user except comments upon user deletion' do
|
||||||
f = Factory.create(:person)
|
person = Factory.create(:person)
|
||||||
|
|
||||||
Factory.create(:status_message, :person => f)
|
Factory.create(:status_message, :person => person)
|
||||||
Factory.create(:blog, :person => f)
|
Factory.create(:status_message, :person => person)
|
||||||
Factory.create(:bookmark, :person => f)
|
Factory.create(:status_message, :person => person)
|
||||||
Factory.create(:status_message, :person => f)
|
Factory.create(:status_message, :person => person)
|
||||||
s = Factory.create(:status_message, :person => @person)
|
|
||||||
|
|
||||||
Factory.create(:comment, :person_id => f.id, :text => "yes i do", :post => s)
|
status_message = Factory.create(:status_message, :person => @person)
|
||||||
Factory.create(:comment, :person_id => f.id, :text => "i love you", :post => s)
|
|
||||||
Factory.create(:comment, :person_id => f.id, :text => "hello", :post => s)
|
|
||||||
Factory.create(:comment, :person_id => @person.id, :text => "you are creepy", :post => s)
|
|
||||||
|
|
||||||
f.destroy
|
Factory.create(:comment, :person_id => person.id, :text => "yes i do", :post => status_message)
|
||||||
|
Factory.create(:comment, :person_id => person.id, :text => "i love you", :post => status_message)
|
||||||
|
Factory.create(:comment, :person_id => person.id, :text => "hello", :post => status_message)
|
||||||
|
Factory.create(:comment, :person_id => @person.id, :text => "you are creepy", :post => status_message)
|
||||||
|
|
||||||
|
person.destroy
|
||||||
|
|
||||||
Post.count.should == 1
|
Post.count.should == 1
|
||||||
Comment.all.count.should == 4
|
Comment.all.count.should == 4
|
||||||
s.comments.count.should == 4
|
status_message.comments.count.should == 4
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "unfriending" do
|
describe "unfriending" do
|
||||||
it 'should delete an orphaned friend' do
|
it 'should delete an orphaned friend' do
|
||||||
|
|
||||||
request = @user.send_friend_request_to @person.receive_url, @group.id
|
request = @user.send_friend_request_to @person.receive_url, @group.id
|
||||||
|
|
||||||
@user.activate_friend(@person, @group)
|
@user.activate_friend(@person, @group)
|
||||||
|
|
@ -77,7 +77,7 @@ describe Person do
|
||||||
request = @user.send_friend_request_to @person.receive_url, @group.id
|
request = @user.send_friend_request_to @person.receive_url, @group.id
|
||||||
request2 = @user2.send_friend_request_to @person.receive_url, @group2.id
|
request2 = @user2.send_friend_request_to @person.receive_url, @group2.id
|
||||||
|
|
||||||
@user.activate_friend(@person, @group)
|
@user.activate_friend (@person, @group)
|
||||||
@user2.activate_friend(@person, @group2)
|
@user2.activate_friend(@person, @group2)
|
||||||
|
|
||||||
@user.reload
|
@user.reload
|
||||||
|
|
@ -96,6 +96,7 @@ describe Person do
|
||||||
Person.all.count.should == 3
|
Person.all.count.should == 3
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'searching' do
|
describe 'searching' do
|
||||||
before do
|
before do
|
||||||
@friend_one = Factory.create(:person)
|
@friend_one = Factory.create(:person)
|
||||||
|
|
@ -119,6 +120,7 @@ describe Person do
|
||||||
@friend_four.profile.last_name = "Grippi"
|
@friend_four.profile.last_name = "Grippi"
|
||||||
@friend_four.save
|
@friend_four.save
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should yield search results on partial names' do
|
it 'should yield search results on partial names' do
|
||||||
people = Person.search("Eu")
|
people = Person.search("Eu")
|
||||||
people.include?(@friend_two).should == true
|
people.include?(@friend_two).should == true
|
||||||
|
|
@ -138,6 +140,7 @@ describe Person do
|
||||||
people.include?(@friend_two).should == false
|
people.include?(@friend_two).should == false
|
||||||
people.include?(@friend_three).should == false
|
people.include?(@friend_three).should == false
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should search by email exactly' do
|
it 'should search by email exactly' do
|
||||||
Person.by_webfinger(@friend_one.email).should == @friend_one
|
Person.by_webfinger(@friend_one.email).should == @friend_one
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -10,20 +10,19 @@ describe Post do
|
||||||
before do
|
before do
|
||||||
@person_one = Factory.create(:person, :email => "some@dudes.com")
|
@person_one = Factory.create(:person, :email => "some@dudes.com")
|
||||||
@person_two = Factory.create(:person, :email => "other@dudes.com")
|
@person_two = Factory.create(:person, :email => "other@dudes.com")
|
||||||
(2..4).each {|n| Blog.create(:title => "title #{n}", :body => "test #{n}", :person => @person_one)}
|
(2..4).each { |n| Factory.create(:status_message, :message => "test #{n}", :person => @person_one) }
|
||||||
(5..8).each { |n| Blog.create(:title => "title #{n}",:body => "test #{n}", :person => @user.person)}
|
(5..8).each { |n| Factory.create(:status_message, :message => "test #{n}", :person => @user.person)}
|
||||||
(9..11).each { |n| Blog.create(:title => "title #{n}",:body => "test #{n}", :person => @person_two)}
|
(9..11).each { |n| Factory.create(:status_message, :message => "test #{n}", :person => @person_two) }
|
||||||
|
|
||||||
Factory.create(:status_message, :person => @user)
|
Factory.create(:status_message, :person => @user)
|
||||||
Factory.create(:bookmark, :person => @user)
|
Factory.create(:status_message, :person => @user)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should give the most recent blog title and body from owner" do
|
it "should give the most recent status_message title and body from owner" do
|
||||||
blog = Blog.newest_for(@user.person)
|
status_message = StatusMessage.newest_for(@user.person)
|
||||||
blog.person.email.should == @user.person.email
|
status_message.person.email.should == @user.person.email
|
||||||
blog.class.should == Blog
|
status_message.class.should == StatusMessage
|
||||||
blog.title.should == "title 8"
|
status_message.message.should == "test 8"
|
||||||
blog.body.should == "test 8"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
@ -35,10 +34,10 @@ describe Post do
|
||||||
@person_two = Factory.create(:person, :email => "other@dudes.com")
|
@person_two = Factory.create(:person, :email => "other@dudes.com")
|
||||||
|
|
||||||
Factory.create(:status_message, :message => "puppies", :created_at => Time.now+1, :person => @owner.person)
|
Factory.create(:status_message, :message => "puppies", :created_at => Time.now+1, :person => @owner.person)
|
||||||
Factory.create(:bookmark, :title => "Reddit", :link => "http://reddit.com", :created_at => Time.now+2, :person => @person_one)
|
Factory.create(:status_message, :message => "http://reddit.com", :created_at => Time.now+2, :person => @person_one)
|
||||||
Factory.create(:status_message, :message => "kittens", :created_at => Time.now+3, :person => @person_two)
|
Factory.create(:status_message, :message => "kittens", :created_at => Time.now+3, :person => @person_two)
|
||||||
Factory.create(:blog, :title => "Bears", :body => "Bear's body", :created_at => Time.now+4, :person => @owner.person)
|
Factory.create(:status_message, :message => "Bear's body", :created_at => Time.now+4, :person => @owner.person)
|
||||||
Factory.create(:bookmark, :title => "Google", :link => "http://google.com", :created_at => Time.now+5, :person => @person_two)
|
Factory.create(:status_message, :message => "Google", :created_at => Time.now+5, :person => @person_two)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should get all posts for a specified user" do
|
it "should get all posts for a specified user" do
|
||||||
|
|
@ -52,7 +51,7 @@ describe Post do
|
||||||
describe 'xml' do
|
describe 'xml' do
|
||||||
it 'should serialize to xml with its person' do
|
it 'should serialize to xml with its person' do
|
||||||
message = Factory.create(:status_message, :person => @user.person)
|
message = Factory.create(:status_message, :person => @user.person)
|
||||||
(message.to_xml.to_s.include? @user.person.email).should == true
|
message.to_xml.to_s.include?(@user.person.email).should == true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue