Sha256: d3d05e30479161c84efebcfb4747e46e768535cae40b677a5dc5a356b552fc7c
Contents?: true
Size: 1.42 KB
Versions: 8
Compression:
Stored size: 1.42 KB
Contents
require 'torque-postgresql' require 'database_cleaner' require 'factory_bot' require 'dotenv' require 'faker' require 'rspec' require 'byebug' Dotenv.load ActiveRecord::Base.establish_connection(ENV['DATABASE_URL'] || { adapter: 'postgresql', username: 'travis', port: 5433, }) cache = ActiveRecord::Base.connection.schema_cache cleaner = ->() do cache.instance_variable_set(:@inheritance_loaded, false) cache.instance_variable_set(:@inheritance_dependencies, {}) cache.instance_variable_set(:@inheritance_associations, {}) end load File.join('schema.rb') Dir.glob(File.join('spec', '{models,factories,mocks}', '**', '*.rb')) do |file| require file[5..-4] end cleaner.call I18n.load_path << Pathname.pwd.join('spec', 'en.yml') RSpec.configure do |config| config.extend Mocks::CreateTable config.include Mocks::CacheQuery config.include FactoryBot::Syntax::Methods config.formatter = :documentation config.color = true config.tty = true # Handles acton before rspec initialize config.before(:suite) do Torque::PostgreSQL.config.schemas.whitelist << 'internal' ActiveSupport::Deprecation.silenced = true DatabaseCleaner.clean_with(:truncation) end config.before(:each) do DatabaseCleaner.strategy = :transaction end config.before(:each) do DatabaseCleaner.start end config.after(:each) do DatabaseCleaner.clean end config.before(:each) do cleaner.call end end
Version data entries
8 entries across 8 versions & 1 rubygems