Sha256: b28809ddc9ebc62097a806488b025d662ac60b78cd10ba9c7d52e5b4c4904aa9

Contents?: true

Size: 1.47 KB

Versions: 5

Compression:

Stored size: 1.47 KB

Contents

# frozen_string_literal: true

# $DEBUG = true

require "rubygems"
require "bundler/setup"
begin
  Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
  $stderr.puts e.message
  $stderr.puts "Run `bundle install` to install missing gems"
  exit e.status_code
end
require "active_record"
require "minitest/autorun"
require "mocha/mini_test"
require "#{File.dirname(__FILE__)}/../init"

if defined?(ActiveRecord::VERSION) &&
  ActiveRecord::VERSION::MAJOR == 4 && ActiveRecord::VERSION::MINOR >= 2

  # Was removed in Rails 5 and is effectively true.
  ActiveRecord::Base.raise_in_transactional_callbacks = true
end

db_config = YAML.load_file(File.expand_path("../database.yml", __FILE__)).fetch(ENV["DB"] || "sqlite")
ActiveRecord::Base.establish_connection(db_config)
ActiveRecord::Schema.verbose = false

# Returns true if ActiveRecord is rails 3, 4 version
def rails_3
  defined?(ActiveRecord::VERSION) && ActiveRecord::VERSION::MAJOR >= 3
end

def rails_4
  defined?(ActiveRecord::VERSION) && ActiveRecord::VERSION::MAJOR >= 4
end

def teardown_db
  if ActiveRecord::VERSION::MAJOR >= 5
    tables = ActiveRecord::Base.connection.data_sources
  else
    tables = ActiveRecord::Base.connection.tables
  end

  tables.each do |table|
    ActiveRecord::Base.connection.drop_table(table)
  end
end

require "shared"

# require 'logger'
# ActiveRecord::Base.logger = Logger.new(STDOUT)

def assert_equal_or_nil(a, b)
  if a.nil?
    assert_nil b
  else
    assert_equal a, b
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
acts_as_list-0.9.19 test/helper.rb
acts_as_list-0.9.18 test/helper.rb
acts_as_list-0.9.17 test/helper.rb
acts_as_list-0.9.16 test/helper.rb
acts_as_list-0.9.11 test/helper.rb