spec/spec_helper.rb in user_preferences-1.0.0 vs spec/spec_helper.rb in user_preferences-1.0.1
- old
+ new
@@ -3,11 +3,16 @@
require 'active_record/connection_adapters/sqlite3_adapter'
RSpec.configure do |config|
$stdout = StringIO.new # silence migrations
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
- ActiveRecord::Migrator.migrate(File.expand_path('../migrations', __FILE__))
+ if ActiveRecord::VERSION::MAJOR >= 5
+ ActiveRecord::Migrator.migrations_paths = File.expand_path('../migrations', __FILE__)
+ ActiveRecord::Base.connection.migration_context.migrate
+ else
+ ActiveRecord::Migrator.migrate(File.expand_path('../migrations', __FILE__))
+ end
$stdout = STDOUT
# prevent deprecation warnings
I18n.enforce_available_locales = true
@@ -19,6 +24,6 @@
UserPreferences.stub(:yml_path).and_return(fixture)
end
class User < ActiveRecord::Base
include UserPreferences::HasPreferences
-end
\ No newline at end of file
+end