Skip to content
Extraits de code Groupes Projets
Valider 720c68e2 rédigé par ilya's avatar ilya
Parcourir les fichiers

Specs all pass

parent c0167a44
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -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,35 +15,7 @@ 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
body = Factory.create(:blog, :title => "yessir", :body => "penguins")
......
......@@ -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,7 +17,35 @@ 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
@owner = Factory.create(:user, :email => "robert@grimm.com")
......
......@@ -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!")
......
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