class EagerLoadIncludeFullStiClassNamesTest
Public Instance Methods
setup()
click to toggle source
# File activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb, line 15 def setup post = Namespaced::Post.create(title: "Great stuff", body: "This is not", author_id: 1) @tagging = Tagging.create(taggable: post) @old = ActiveRecord::Base.store_full_sti_class end
teardown()
click to toggle source
# File activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb, line 21 def teardown ActiveRecord::Base.store_full_sti_class = @old end
test_class_names_with_eager_load()
click to toggle source
# File activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb, line 35 def test_class_names_with_eager_load ActiveRecord::Base.store_full_sti_class = false post = Namespaced::Post.eager_load(:tagging).find_by_title("Great stuff") assert_nil post.tagging ActiveRecord::Base.store_full_sti_class = true post = Namespaced::Post.eager_load(:tagging).find_by_title("Great stuff") assert_equal @tagging, post.tagging end
test_class_names_with_includes()
click to toggle source
# File activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb, line 25 def test_class_names_with_includes ActiveRecord::Base.store_full_sti_class = false post = Namespaced::Post.includes(:tagging).find_by_title("Great stuff") assert_nil post.tagging ActiveRecord::Base.store_full_sti_class = true post = Namespaced::Post.includes(:tagging).find_by_title("Great stuff") assert_equal @tagging, post.tagging end