Skip to content
Extraits de code Groupes Projets
Valider 43dd9514 rédigé par Raphael's avatar Raphael
Parcourir les fichiers

Starting to remove database-cleaner

parent b007ba14
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -6,7 +6,7 @@ require 'spec_helper'
describe Diaspora::Parser do
before do
@user = Factory.create(:user, :email => "bob@aol.com")
@user = Factory.create(:user)
@aspect = @user.aspect(:name => 'spies')
@user3 = Factory.create :user
......@@ -20,7 +20,7 @@ describe Diaspora::Parser do
end
it 'should be able to correctly handle comments with person in db' do
person = Factory.create(:person, :diaspora_handle => "test@testing.com")
person = Factory.create(:person)
post = Factory.create(:status_message, :person => @user.person)
comment = Factory.build(:comment, :post => post, :person => person, :text => "Freedom!")
xml = comment.to_diaspora_xml
......
......@@ -5,34 +5,13 @@
require 'spec_helper'
describe 'making sure the spec runner works' do
it 'should not delete the database mid-spec' do
User.count.should == 0
Factory.create(:user)
User.count.should == 1
end
it 'should make sure the last user no longer exsists' do
User.count.should == 0
end
it 'should factory create a user with a person saved' do
user = Factory.create(:user)
loaded_user = User.first(:id => user.id)
loaded_user.person.owner_id.should == user.id
end
describe 'testing a before do block' do
before do
Factory.create(:user)
end
it 'should have cleaned before the before do block runs' do
User.count.should == 1
end
end
describe '#friend_users' do
describe '#friend_users' do
before do
@user1 = Factory.create(:user)
@aspect1 = @user1.aspect(:name => "losers")
......
......@@ -18,7 +18,7 @@ describe Comment do
status.comments.should == []
@user.comment "Yeah, it was great", :on => status
StatusMessage.first.comments.first.text.should == "Yeah, it was great"
status.reload.comments.first.text.should == "Yeah, it was great"
end
it "should be able to comment on a person's status" do
......@@ -26,8 +26,8 @@ describe Comment do
status = Factory.create(:status_message, :person => person)
@user.comment "sup dog", :on => status
StatusMessage.first.comments.first.text.should == "sup dog"
StatusMessage.first.comments.first.person.should == @user.person
status.reload.comments.first.text.should == "sup dog"
status.reload.comments.first.person.should == @user.person
end
it 'should not send out comments when we have no people' do
......
......@@ -27,19 +27,14 @@ RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
DatabaseCleaner.clean
stub_signature_verification
end
config.before(:each) do
DatabaseCleaner.start
stub_sockets
User.stub!(:allowed_email?).and_return(:true)
end
config.after(:each) do
DatabaseCleaner.clean
end
end
ImageUploader.enable_processing = false
......
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