mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
parent
fba75f0ae3
commit
6e64de0f1c
1 changed files with 14 additions and 8 deletions
|
@ -541,8 +541,10 @@ class UncastableReflectionTest < ActiveRecord::TestCase
|
||||||
teardown do
|
teardown do
|
||||||
Book._reflections.clear
|
Book._reflections.clear
|
||||||
Book.clear_reflections_cache
|
Book.clear_reflections_cache
|
||||||
Subscriber.has_many :books, through: :subscriptions
|
silence_warnings do
|
||||||
Subscriber.has_one :book, through: :subscription
|
Subscriber.has_many :books, through: :subscriptions
|
||||||
|
Subscriber.has_one :book, through: :subscription
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
test "uncastable has_many through: reflection" do
|
test "uncastable has_many through: reflection" do
|
||||||
|
@ -553,11 +555,6 @@ class UncastableReflectionTest < ActiveRecord::TestCase
|
||||||
MSG
|
MSG
|
||||||
end
|
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
|
test "uncastable has_one through: reflection" do
|
||||||
error = assert_raises(NotImplementedError) { @subscriber.book }
|
error = assert_raises(NotImplementedError) { @subscriber.book }
|
||||||
|
|
||||||
|
@ -567,8 +564,17 @@ class UncastableReflectionTest < ActiveRecord::TestCase
|
||||||
MSG
|
MSG
|
||||||
end
|
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
|
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
|
@subscriber.book
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue