Skip to content

Commit

Permalink
remove debug
Browse files Browse the repository at this point in the history
  • Loading branch information
seuros committed Jan 18, 2024
1 parent 1837fd0 commit d5719d2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ tmp/
.ruby-*
*.iml
coverage/
.env
12 changes: 6 additions & 6 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,14 @@ def sqlite?
# see: https://relishapp.com/rspec/rspec-core/v/3-8/docs/configuration/zero-monkey-patching-mode
config.disable_monkey_patching!

if sqlite?

config.before(:suite) do
ENV['FLOCK_DIR'] = Dir.mktmpdir
ENV['FLOCK_DIR'] = Dir.mktmpdir if sqlite?
end

config.after(:suite) do
FileUtils.remove_entry_secure ENV['FLOCK_DIR']
FileUtils.remove_entry_secure( ENV['FLOCK_DIR']) if sqlite?
end
end
end

# Configure parallel specs
Expand All @@ -94,14 +93,15 @@ def sqlite?
# See: https://github.com/ClosureTree/with_advisory_lock
ENV['WITH_ADVISORY_LOCK_PREFIX'] ||= SecureRandom.hex

ActiveRecord::Base.connection.recreate_database("closure_tree_test") unless sqlite?
puts "Testing with #{env_db} database, ActiveRecord #{ActiveRecord.gem_version} and #{RUBY_ENGINE} #{RUBY_ENGINE_VERSION} as #{RUBY_VERSION}"
# Require our gem
require 'closure_tree'
ActiveRecord::Tasks::DatabaseTasks.create_current('default_env')
ActiveRecord::Tasks::DatabaseTasks.create_current('secondary_env')

# Load test helpers
require_relative 'support/schema'
require_relative 'support/models'
require_relative 'support/helpers'
require_relative 'support/exceed_query_limit'
require_relative 'support/query_counter'
puts "Testing with #{env_db} database, ActiveRecord #{ActiveRecord.gem_version} and #{RUBY_ENGINE} #{RUBY_ENGINE_VERSION} as #{RUBY_VERSION}"
9 changes: 6 additions & 3 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

ENV['WITH_ADVISORY_LOCK_PREFIX'] ||= SecureRandom.hex


def env_db
@env_db ||= ActiveRecord::Base.connection_db_config.adapter.to_sym
end
Expand All @@ -37,9 +36,9 @@ def sqlite?
env_db == :sqlite3
end

puts "Testing with #{env_db} database, ActiveRecord #{ActiveRecord.gem_version} and #{RUBY_ENGINE} #{RUBY_ENGINE_VERSION} as #{RUBY_VERSION}"

DatabaseCleaner.strategy = :truncation
DatabaseCleaner.allow_remote_database_url = true

module Minitest
class Spec
Expand All @@ -61,6 +60,10 @@ class Spec
Thread.abort_on_exception = true

require 'closure_tree'
ActiveRecord::Tasks::DatabaseTasks.create_current('default_env')
ActiveRecord::Tasks::DatabaseTasks.create_current('secondary_env')

require_relative '../spec/support/schema'
require_relative '../spec/support/models'
ActiveRecord::Base.connection.recreate_database('closure_tree_test') unless sqlite?

puts "Testing with #{env_db} database, ActiveRecord #{ActiveRecord.gem_version} and #{RUBY_ENGINE} #{RUBY_ENGINE_VERSION} as #{RUBY_VERSION}"

0 comments on commit d5719d2

Please sign in to comment.