@@ -826,11 +826,15 @@ def test_limited_eager_with_numeric_in_association
826826 end
827827
828828 def test_preload_with_interpolation
829- post = Post . includes ( :comments_with_interpolated_conditions ) . find ( posts ( :welcome ) . id )
830- assert_equal [ comments ( :greetings ) ] , post . comments_with_interpolated_conditions
829+ assert_deprecated do
830+ post = Post . includes ( :comments_with_interpolated_conditions ) . find ( posts ( :welcome ) . id )
831+ assert_equal [ comments ( :greetings ) ] , post . comments_with_interpolated_conditions
832+ end
831833
832- post = Post . joins ( :comments_with_interpolated_conditions ) . find ( posts ( :welcome ) . id )
833- assert_equal [ comments ( :greetings ) ] , post . comments_with_interpolated_conditions
834+ assert_deprecated do
835+ post = Post . joins ( :comments_with_interpolated_conditions ) . find ( posts ( :welcome ) . id )
836+ assert_equal [ comments ( :greetings ) ] , post . comments_with_interpolated_conditions
837+ end
834838 end
835839
836840 def test_polymorphic_type_condition
@@ -1232,4 +1236,23 @@ def test_deep_including_through_habtm
12321236 assert_equal 2 , author . posts . size
12331237 }
12341238 end
1239+
1240+ test "include instance dependent associations is deprecated" do
1241+ message = "association scope 'posts_with_signature' is"
1242+ assert_deprecated message do
1243+ begin
1244+ Author . includes ( :posts_with_signature ) . to_a
1245+ rescue NoMethodError
1246+ # it's expected that preloading of this association fails
1247+ end
1248+ end
1249+
1250+ assert_deprecated message do
1251+ Author . preload ( :posts_with_signature ) . to_a rescue NoMethodError
1252+ end
1253+
1254+ assert_deprecated message do
1255+ Author . eager_load ( :posts_with_signature ) . to_a
1256+ end
1257+ end
12351258end
0 commit comments