From 43dd95147eccaa741d930c1377cf7dfd47286efc Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 19 Oct 2010 18:38:39 -0700 Subject: [PATCH] Starting to remove database-cleaner --- spec/lib/diaspora_parser_spec.rb | 4 ++-- spec/misc_spec.rb | 23 +---------------------- spec/models/comments_spec.rb | 6 +++--- spec/spec_helper.rb | 7 +------ 4 files changed, 7 insertions(+), 33 deletions(-) diff --git a/spec/lib/diaspora_parser_spec.rb b/spec/lib/diaspora_parser_spec.rb index 3b9e090f9..3504cfc73 100644 --- a/spec/lib/diaspora_parser_spec.rb +++ b/spec/lib/diaspora_parser_spec.rb @@ -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 diff --git a/spec/misc_spec.rb b/spec/misc_spec.rb index 1db3f3f82..12f7837c1 100644 --- a/spec/misc_spec.rb +++ b/spec/misc_spec.rb @@ -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") diff --git a/spec/models/comments_spec.rb b/spec/models/comments_spec.rb index b2f2d3c61..08252ada2 100644 --- a/spec/models/comments_spec.rb +++ b/spec/models/comments_spec.rb @@ -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 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 552fd884d..9bc58c2e6 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -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