spec/spec_helper.rb in locker-0.2.1 vs spec/spec_helper.rb in locker-0.3.0

- old
+ new

@@ -6,11 +6,11 @@ require 'active_record' require 'locker' ActiveRecord::Base.time_zone_aware_attributes = true -ActiveRecord::Base.default_timezone = "UTC" +ActiveRecord::Base.default_timezone = :utc if File.exist?(File.join(File.dirname(__FILE__), 'database.yml')) config = YAML.load_file(File.join(File.dirname(__FILE__), 'database.yml')) else puts "database.yml did not exist, using defaults" @@ -75,13 +75,21 @@ end end RSpec.configure do |c| c.before do - ActiveRecord::Base.connection.increment_open_transactions - ActiveRecord::Base.connection.begin_db_transaction + if ActiveRecord::VERSION::MAJOR < 4 + ActiveRecord::Base.connection.increment_open_transactions + ActiveRecord::Base.connection.begin_db_transaction + else + ActiveRecord::Base.connection.begin_transaction + end end c.after do - ActiveRecord::Base.connection.rollback_db_transaction - ActiveRecord::Base.connection.decrement_open_transactions + if ActiveRecord::VERSION::MAJOR < 4 + ActiveRecord::Base.connection.rollback_db_transaction + ActiveRecord::Base.connection.decrement_open_transactions + else + ActiveRecord::Base.connection.rollback_transaction + end end end