Fix build by turning off transactional fixtures in the import spec.
This commit is contained in:
parent
6e65f3408d
commit
b43c29745b
1 changed files with 39 additions and 2 deletions
|
|
@ -6,6 +6,10 @@ require 'spec_helper'
|
||||||
Dir.glob(File.join(Rails.root, 'lib', 'data_conversion', '*.rb')).each { |f| require f }
|
Dir.glob(File.join(Rails.root, 'lib', 'data_conversion', '*.rb')).each { |f| require f }
|
||||||
|
|
||||||
describe DataConversion::ImportToMysql do
|
describe DataConversion::ImportToMysql do
|
||||||
|
|
||||||
|
# load data infile messes with transactional rollback
|
||||||
|
self.use_transactional_fixtures = false
|
||||||
|
|
||||||
def copy_fixture_for(table_name)
|
def copy_fixture_for(table_name)
|
||||||
FileUtils.cp("#{Rails.root}/spec/fixtures/data_conversion/#{table_name}.csv",
|
FileUtils.cp("#{Rails.root}/spec/fixtures/data_conversion/#{table_name}.csv",
|
||||||
"#{@migrator.full_path}/#{table_name}.csv")
|
"#{@migrator.full_path}/#{table_name}.csv")
|
||||||
|
|
@ -17,7 +21,38 @@ describe DataConversion::ImportToMysql do
|
||||||
@migrator.send("process_raw_#{table_name}".to_sym)
|
@migrator.send("process_raw_#{table_name}".to_sym)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def delete_everything
|
||||||
|
Mongo::User.delete_all
|
||||||
|
Mongo::Aspect.delete_all
|
||||||
|
Mongo::AspectMembership.delete_all
|
||||||
|
Mongo::Comment.delete_all
|
||||||
|
Mongo::Invitation.delete_all
|
||||||
|
Mongo::Notification.delete_all
|
||||||
|
Mongo::Person.delete_all
|
||||||
|
Mongo::Profile.delete_all
|
||||||
|
Mongo::Post.delete_all
|
||||||
|
Mongo::Contact.delete_all
|
||||||
|
Mongo::PostVisibility.delete_all
|
||||||
|
Mongo::Request.delete_all
|
||||||
|
Mongo::Service.delete_all
|
||||||
|
|
||||||
|
User.delete_all
|
||||||
|
Aspect.delete_all
|
||||||
|
AspectMembership.delete_all
|
||||||
|
Comment.delete_all
|
||||||
|
Invitation.delete_all
|
||||||
|
Notification.delete_all
|
||||||
|
Person.delete_all
|
||||||
|
Profile.delete_all
|
||||||
|
Post.delete_all
|
||||||
|
Contact.delete_all
|
||||||
|
PostVisibility.delete_all
|
||||||
|
Request.delete_all
|
||||||
|
Service.delete_all
|
||||||
|
end
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
delete_everything
|
||||||
@migrator = DataConversion::ImportToMysql.new
|
@migrator = DataConversion::ImportToMysql.new
|
||||||
@migrator.full_path = "/tmp/data_conversion"
|
@migrator.full_path = "/tmp/data_conversion"
|
||||||
system("rm -rf #{@migrator.full_path}")
|
system("rm -rf #{@migrator.full_path}")
|
||||||
|
|
@ -54,7 +89,6 @@ describe DataConversion::ImportToMysql do
|
||||||
bob.password_salt.should_not be_nil
|
bob.password_salt.should_not be_nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "aspects" do
|
describe "aspects" do
|
||||||
before do
|
before do
|
||||||
import_and_process("users")
|
import_and_process("users")
|
||||||
|
|
@ -294,7 +328,7 @@ describe DataConversion::ImportToMysql do
|
||||||
profile.person_id.should == Person.where(:mongo_id => profile.mongo_id).first.id
|
profile.person_id.should == Person.where(:mongo_id => profile.mongo_id).first.id
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
describe "posts" do
|
describe "posts" do
|
||||||
before do
|
before do
|
||||||
import_and_process("users")
|
import_and_process("users")
|
||||||
import_and_process("people")
|
import_and_process("people")
|
||||||
|
|
@ -742,4 +776,7 @@ describe DataConversion::ImportToMysql do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Otherwise, subsequent tests can't load the fixtures
|
||||||
|
self.use_transactional_fixtures = true
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue