Starting to remove database-cleaner

This commit is contained in:
Raphael 2010-10-19 18:38:39 -07:00
parent b007ba1487
commit 43dd95147e
4 changed files with 7 additions and 33 deletions

View file

@ -6,7 +6,7 @@ require 'spec_helper'
describe Diaspora::Parser do describe Diaspora::Parser do
before do before do
@user = Factory.create(:user, :email => "bob@aol.com") @user = Factory.create(:user)
@aspect = @user.aspect(:name => 'spies') @aspect = @user.aspect(:name => 'spies')
@user3 = Factory.create :user @user3 = Factory.create :user
@ -20,7 +20,7 @@ describe Diaspora::Parser do
end end
it 'should be able to correctly handle comments with person in db' do 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) post = Factory.create(:status_message, :person => @user.person)
comment = Factory.build(:comment, :post => post, :person => person, :text => "Freedom!") comment = Factory.build(:comment, :post => post, :person => person, :text => "Freedom!")
xml = comment.to_diaspora_xml xml = comment.to_diaspora_xml

View file

@ -5,34 +5,13 @@
require 'spec_helper' require 'spec_helper'
describe 'making sure the spec runner works' do 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 it 'should factory create a user with a person saved' do
user = Factory.create(:user) user = Factory.create(:user)
loaded_user = User.first(:id => user.id) loaded_user = User.first(:id => user.id)
loaded_user.person.owner_id.should == user.id loaded_user.person.owner_id.should == user.id
end end
describe 'testing a before do block' do
before do
Factory.create(:user)
end describe '#friend_users' do
it 'should have cleaned before the before do block runs' do
User.count.should == 1
end
end
describe '#friend_users' do
before do before do
@user1 = Factory.create(:user) @user1 = Factory.create(:user)
@aspect1 = @user1.aspect(:name => "losers") @aspect1 = @user1.aspect(:name => "losers")

View file

@ -18,7 +18,7 @@ describe Comment do
status.comments.should == [] status.comments.should == []
@user.comment "Yeah, it was great", :on => status @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 end
it "should be able to comment on a person's status" do 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) status = Factory.create(:status_message, :person => person)
@user.comment "sup dog", :on => status @user.comment "sup dog", :on => status
StatusMessage.first.comments.first.text.should == "sup dog" status.reload.comments.first.text.should == "sup dog"
StatusMessage.first.comments.first.person.should == @user.person status.reload.comments.first.person.should == @user.person
end end
it 'should not send out comments when we have no people' do it 'should not send out comments when we have no people' do

View file

@ -27,19 +27,14 @@ RSpec.configure do |config|
config.before(:suite) do config.before(:suite) do
DatabaseCleaner.clean_with(:truncation) DatabaseCleaner.clean_with(:truncation)
DatabaseCleaner.clean
stub_signature_verification stub_signature_verification
end end
config.before(:each) do config.before(:each) do
DatabaseCleaner.start
stub_sockets stub_sockets
User.stub!(:allowed_email?).and_return(:true) User.stub!(:allowed_email?).and_return(:true)
end end
config.after(:each) do
DatabaseCleaner.clean
end
end end
ImageUploader.enable_processing = false ImageUploader.enable_processing = false