Sha256: 2ca6af97d188aeaa0d5d475333d7c14f6ed0f565d8819811643243cbbdaa0cfc

Contents?: true

Size: 1.28 KB

Versions: 5

Compression:

Stored size: 1.28 KB

Contents

# encoding: UTF-8

require 'simplecov'
require 'coveralls'

SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
  SimpleCov::Formatter::HTMLFormatter,
  Coveralls::SimpleCov::Formatter
])
SimpleCov.start do
 add_filter 'spec'
end

require 'active_record'
if ActiveRecord::VERSION::MAJOR >= 5
  ActiveRecord::Base.belongs_to_required_by_default = true
end

require 'logger'
require 'database_cleaner'
require 'rails_multitenant'
require 'yaml'

FileUtils.makedirs('log')

ActiveRecord::Base.logger = Logger.new('log/test.log')
ActiveRecord::Base.logger.level = Logger::DEBUG
ActiveRecord::Migration.verbose = false

db_adapter = ENV.fetch('ADAPTER', 'sqlite3')
config = YAML.load(File.read('spec/db/database.yml'))
ActiveRecord::Base.establish_connection(config[db_adapter])
require 'db/schema'

RSpec.configure do |config|
  config.order = 'random'

  config.before(:suite) do
    DatabaseCleaner.clean_with(:truncation)
  end

  config.before(:each) do
    DatabaseCleaner.strategy = :transaction
    DatabaseCleaner.start
    RailsMultitenant::GlobalContextRegistry.new_registry
    Organization.current_id = Organization.create!.id
  end

  config.after(:each) do
    DatabaseCleaner.clean
  end
end

puts "Testing with Ruby #{RUBY_VERSION} and ActiveRecord #{ActiveRecord::VERSION::STRING}"

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rails_multitenant-0.12.0 spec/spec_helper.rb
rails_multitenant-0.11.0 spec/spec_helper.rb
rails_multitenant-0.10.0 spec/spec_helper.rb
rails_multitenant-0.9.0 spec/spec_helper.rb
rails_multitenant-0.8.0 spec/spec_helper.rb