mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Removes require_dependency from the AR test suite
In the AR test suite require_dependency does not make much sense. Just call vanilla require/load. Note that in the test that made explicit use of it, there are no autoload paths, and no constants have been autoloaded. In reality, the code ended up calling Kernel#load.
This commit is contained in:
parent
92d3afe475
commit
afabe994e0
5 changed files with 7 additions and 8 deletions
|
@ -57,12 +57,11 @@ class MultipleDbTest < ActiveRecord::TestCase
|
|||
assert_equal e3.course.id, c2.id
|
||||
end
|
||||
|
||||
def test_course_connection_should_survive_dependency_reload
|
||||
def test_course_connection_should_survive_reloads
|
||||
assert Course.connection
|
||||
|
||||
ActiveSupport::Dependencies.clear
|
||||
Object.send(:remove_const, :Course)
|
||||
require_dependency "models/course"
|
||||
assert Object.send(:remove_const, :Course)
|
||||
assert load("models/course.rb")
|
||||
|
||||
assert Course.connection
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_dependency "models/arunit2_model"
|
||||
require "models/arunit2_model"
|
||||
require "active_support/core_ext/object/with_options"
|
||||
|
||||
class College < ARUnit2Model
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_dependency "models/arunit2_model"
|
||||
require "models/arunit2_model"
|
||||
|
||||
class Course < ARUnit2Model
|
||||
belongs_to :college
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_dependency "models/arunit2_model"
|
||||
require "models/arunit2_model"
|
||||
|
||||
class OtherDog < ARUnit2Model
|
||||
self.table_name = "dogs"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_dependency "models/arunit2_model"
|
||||
require "models/arunit2_model"
|
||||
|
||||
class Professor < ARUnit2Model
|
||||
has_and_belongs_to_many :courses
|
||||
|
|
Loading…
Reference in a new issue