提交 afabe994 编写于 作者: X Xavier Noria

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.
上级 92d3afe4
......@@ -57,12 +57,11 @@ def test_associations
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
......
# frozen_string_literal: true
require_dependency "models/arunit2_model"
require "models/arunit2_model"
require "active_support/core_ext/object/with_options"
class College < ARUnit2Model
......
# frozen_string_literal: true
require_dependency "models/arunit2_model"
require "models/arunit2_model"
class Course < ARUnit2Model
belongs_to :college
......
# frozen_string_literal: true
require_dependency "models/arunit2_model"
require "models/arunit2_model"
class OtherDog < ARUnit2Model
self.table_name = "dogs"
......
# frozen_string_literal: true
require_dependency "models/arunit2_model"
require "models/arunit2_model"
class Professor < ARUnit2Model
has_and_belongs_to_many :courses
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册