Skip to content

Commit

Permalink
Merge pull request #59 from khiav223577/refactor/autoload
Browse files Browse the repository at this point in the history
Refactor: use gem to setup autoload paths in tests
  • Loading branch information
khiav223577 authored Jan 21, 2022
2 parents 73ca9d6 + 42ea61b commit 2a87d15
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pluck_all.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
}

spec.add_dependency 'activesupport', '>= 3.0.0'
spec.add_dependency 'rails_compatibility', '>= 0.0.7'
spec.add_dependency 'rails_compatibility', '>= 0.0.8'

spec.add_development_dependency 'bundler', '>= 1.17', '< 3.x'
spec.add_development_dependency 'rake', '~> 12.0'
Expand Down
10 changes: 2 additions & 8 deletions test/active_record/support/seeds.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
# frozen_string_literal: true

ActiveSupport::Dependencies.autoload_paths << File.expand_path('../models/', __FILE__)

if ActiveSupport::VERSION::MAJOR >= 7
require 'zeitwerk'
loader = Zeitwerk::Loader.for_gem
ActiveSupport::Dependencies.autoload_paths.each{|path| loader.push_dir(path) }
loader.setup
end
require 'rails_compatibility/setup_autoload_paths'
RailsCompatibility.setup_autoload_paths [File.expand_path('../models/', __FILE__)]

ActiveRecord::Schema.define do
self.verbose = false
Expand Down

0 comments on commit 2a87d15

Please sign in to comment.