Specs all pass
This commit is contained in:
parent
c0167a445a
commit
720c68e2c6
5 changed files with 32 additions and 62 deletions
|
|
@ -7,7 +7,7 @@ describe Diaspora do
|
|||
|
||||
describe Webhooks do
|
||||
before do
|
||||
Factory.create(:user, :email => "bob@aol.com")
|
||||
@user = Factory.create(:user, :email => "bob@aol.com")
|
||||
end
|
||||
|
||||
describe "header" do
|
||||
|
|
@ -35,7 +35,7 @@ describe Diaspora do
|
|||
|
||||
describe "body" do
|
||||
before do
|
||||
@post = Factory.create(:status_message)
|
||||
@post = Factory.create(:status_message, :person => @user)
|
||||
end
|
||||
|
||||
it "should add the following methods to Post on inclusion" do
|
||||
|
|
|
|||
|
|
@ -15,34 +15,6 @@ describe Blog do
|
|||
end
|
||||
|
||||
|
||||
describe "newest" do
|
||||
before do
|
||||
@friend_one = Factory.create(:friend, :email => "some@dudes.com")
|
||||
@friend_two = Factory.create(:friend, :email => "other@dudes.com")
|
||||
(2..4).each {|n| Blog.create(:title => "title #{n}", :body => "test #{n}", :person => @friend_one)}
|
||||
(5..8).each { |n| Blog.create(:title => "title #{n}",:body => "test #{n}", :person => @user)}
|
||||
(9..11).each { |n| Blog.create(:title => "title #{n}",:body => "test #{n}", :person => @friend_two)}
|
||||
|
||||
Factory.create(:status_message)
|
||||
Factory.create(:bookmark)
|
||||
end
|
||||
|
||||
it "should give the most recent blog title and body from owner" do
|
||||
blog = Blog.my_newest()
|
||||
blog.person.email.should == @user.email
|
||||
blog.class.should == Blog
|
||||
blog.title.should == "title 8"
|
||||
blog.body.should == "test 8"
|
||||
end
|
||||
|
||||
it "should give the most recent blog body for a given email" do
|
||||
blog = Blog.newest_by_email("some@dudes.com")
|
||||
blog.person.email.should == @friend_one.email
|
||||
blog.class.should == Blog
|
||||
blog.title.should == "title 4"
|
||||
blog.body.should == "test 4"
|
||||
end
|
||||
end
|
||||
|
||||
describe "XML" do
|
||||
it 'should serialize to XML' do
|
||||
|
|
|
|||
|
|
@ -8,12 +8,6 @@ describe Bookmark do
|
|||
bookmark.valid?.should be true
|
||||
end
|
||||
|
||||
it "should add an owner if none is present" do
|
||||
Factory.create(:user, :email => "bob@aol.com")
|
||||
n = Factory.create(:bookmark)
|
||||
n.person.email.should == "bob@aol.com"
|
||||
end
|
||||
|
||||
it 'should validate its link' do
|
||||
bookmark = Factory.build(:bookmark)
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ require File.dirname(__FILE__) + '/../spec_helper'
|
|||
|
||||
describe Post do
|
||||
before do
|
||||
Factory.create(:user, :email => "bob@aol.com")
|
||||
@user = Factory.create(:user, :email => "bob@aol.com")
|
||||
end
|
||||
|
||||
describe 'defaults' do
|
||||
|
|
@ -17,6 +17,34 @@ describe Post do
|
|||
|
||||
end
|
||||
|
||||
describe "newest" do
|
||||
before do
|
||||
@friend_one = Factory.create(:friend, :email => "some@dudes.com")
|
||||
@friend_two = Factory.create(:friend, :email => "other@dudes.com")
|
||||
(2..4).each {|n| Blog.create(:title => "title #{n}", :body => "test #{n}", :person => @friend_one)}
|
||||
(5..8).each { |n| Blog.create(:title => "title #{n}",:body => "test #{n}", :person => @user)}
|
||||
(9..11).each { |n| Blog.create(:title => "title #{n}",:body => "test #{n}", :person => @friend_two)}
|
||||
|
||||
Factory.create(:status_message)
|
||||
Factory.create(:bookmark)
|
||||
end
|
||||
|
||||
it "should give the most recent blog title and body from owner" do
|
||||
blog = Blog.my_newest()
|
||||
blog.person.email.should == @user.email
|
||||
blog.class.should == Blog
|
||||
blog.title.should == "title 8"
|
||||
blog.body.should == "test 8"
|
||||
end
|
||||
|
||||
it "should give the most recent blog body for a given email" do
|
||||
blog = Blog.newest_by_email("some@dudes.com")
|
||||
blog.person.email.should == @friend_one.email
|
||||
blog.class.should == Blog
|
||||
blog.title.should == "title 4"
|
||||
blog.body.should == "test 4"
|
||||
end
|
||||
end
|
||||
|
||||
describe "stream" do
|
||||
before do
|
||||
|
|
|
|||
|
|
@ -12,30 +12,6 @@ describe StatusMessage do
|
|||
n.valid?.should be true
|
||||
end
|
||||
|
||||
|
||||
it "should add an owner if none is present" do
|
||||
n = Factory.create(:status_message)
|
||||
n.person.email.should == "bob@aol.com"
|
||||
end
|
||||
|
||||
describe "newest" do
|
||||
before do
|
||||
@person_one = Factory.create(:friend,:email => "some@dudes.com")
|
||||
(1..10).each { Factory.create(:status_message, :person => @person_one) }
|
||||
(1..5).each { Factory.create(:status_message) }
|
||||
Factory.create(:bookmark)
|
||||
Factory.create(:bookmark, :person => @person_one)
|
||||
end
|
||||
|
||||
it "should give the most recent message from a friend" do
|
||||
StatusMessage.newest(@person_one).message.should == "jimmy's 13 whales"
|
||||
end
|
||||
|
||||
it "should give the most recent message for a given email" do
|
||||
StatusMessage.newest_by_email(@person_one.email).message.should == "jimmy's 28 whales"
|
||||
end
|
||||
end
|
||||
|
||||
describe "XML" do
|
||||
it 'should serialize to XML' do
|
||||
message = Factory.create(:status_message, :message => "I hate WALRUSES!")
|
||||
|
|
|
|||
Loading…
Reference in a new issue