Sha256: a387c8c4d195e2cef6bb3105c14360c738870e745cb4d45de42ac4749de28202

Contents?: true

Size: 1.53 KB

Versions: 7

Compression:

Stored size: 1.53 KB

Contents

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))

require 'active_record/railtie'
require 'action_controller/railtie'
require 'rspec/rails'

require 'activerecord-multi-tenant'

require 'bundler'
Bundler.require(:default, :development)

dbconfig = YAML::load(IO.read(File.join(File.dirname(__FILE__), 'database.yml')))
ActiveRecord::Base.logger = Logger.new(File.join(File.dirname(__FILE__), "debug.log"))
ActiveRecord::Base.establish_connection(dbconfig['test'])

RSpec.configure do |config|
  config.infer_base_class_for_anonymous_controllers = true
  config.use_transactional_fixtures = false
  config.filter_run_excluding type: :controller unless Object.const_defined?(:ActionController)

  config.after(:each) do
    MultiTenant.current_tenant = nil
  end

  config.before(:suite) do
    MultiTenant::FastTruncate.run

    # Keep this here until https://github.com/citusdata/citus/issues/1236 is fixed
    MultiTenant.enable_with_lock_workaround
  end

  config.after(:each) do
    MultiTenant::FastTruncate.run
  end
end

module MultiTenantTest
  class Application < Rails::Application; end
end

MultiTenantTest::Application.config.secret_token = 'x' * 40
MultiTenantTest::Application.config.secret_key_base = 'y' * 40

def uses_prepared_statements?
  if ActiveRecord::VERSION::MAJOR == 4
    config = ActiveRecord::Base.connection.instance_variable_get(:@config)
    config.fetch(:prepared_statements, true)
  else
    ActiveRecord::Base.connection.prepared_statements
  end
end

require 'schema'

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
activerecord-multi-tenant-1.0.4 spec/spec_helper.rb
activerecord-multi-tenant-1.0.3 spec/spec_helper.rb
activerecord-multi-tenant-1.0.2 spec/spec_helper.rb
activerecord-multi-tenant-1.0.1 spec/spec_helper.rb
activerecord-multi-tenant-1.0.0 spec/spec_helper.rb
activerecord-multi-tenant-0.11.0 spec/spec_helper.rb
activerecord-multi-tenant-0.10.0 spec/spec_helper.rb