1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Silence method redefined warnings

Caused by #37120.
This commit is contained in:
Ryuta Kamizono 2019-09-17 15:52:40 +09:00
parent fba75f0ae3
commit 6e64de0f1c

View file

@ -541,8 +541,10 @@ class UncastableReflectionTest < ActiveRecord::TestCase
teardown do
Book._reflections.clear
Book.clear_reflections_cache
Subscriber.has_many :books, through: :subscriptions
Subscriber.has_one :book, through: :subscription
silence_warnings do
Subscriber.has_many :books, through: :subscriptions
Subscriber.has_one :book, through: :subscription
end
end
test "uncastable has_many through: reflection" do
@ -553,11 +555,6 @@ class UncastableReflectionTest < ActiveRecord::TestCase
MSG
end
test "fixing uncastable has_many through: reflection with has_many" do
Book.has_many :subscriptions
@subscriber.books
end
test "uncastable has_one through: reflection" do
error = assert_raises(NotImplementedError) { @subscriber.book }
@ -567,8 +564,17 @@ class UncastableReflectionTest < ActiveRecord::TestCase
MSG
end
test "fixing uncastable has_many through: reflection with has_many" do
silence_warnings do
Book.has_many :subscriptions
end
@subscriber.books
end
test "fixing uncastable has_one through: reflection with has_many" do
Book.has_many :subscriptions
silence_warnings do
Book.has_many :subscriptions
end
@subscriber.book
end