Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
34c54f96
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
34c54f96
编写于
8月 25, 2020
作者:
E
Eugene Kenny
提交者:
GitHub
8月 25, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #40104 from p8/happy-human
Rename horrible and dirty to puzzled and confused in test models
上级
bdd00fb2
504a9d50
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
10 addition
and
10 deletion
+10
-10
activerecord/test/cases/associations/inverse_associations_test.rb
...cord/test/cases/associations/inverse_associations_test.rb
+5
-5
activerecord/test/models/face.rb
activerecord/test/models/face.rb
+2
-2
activerecord/test/models/human.rb
activerecord/test/models/human.rb
+1
-1
activerecord/test/schema/schema.rb
activerecord/test/schema/schema.rb
+2
-2
未找到文件。
activerecord/test/cases/associations/inverse_associations_test.rb
浏览文件 @
34c54f96
...
...
@@ -297,7 +297,7 @@ def test_parent_instance_should_be_shared_with_replaced_via_accessor_child
end
def
test_trying_to_use_inverses_that_dont_exist_should_raise_an_error
assert_raise
(
ActiveRecord
::
InverseOfAssociationNotFoundError
)
{
Human
.
first
.
dirty
_face
}
assert_raise
(
ActiveRecord
::
InverseOfAssociationNotFoundError
)
{
Human
.
first
.
confused
_face
}
end
end
...
...
@@ -648,7 +648,7 @@ def test_child_instance_should_be_shared_with_replaced_via_accessor_parent
end
def
test_trying_to_use_inverses_that_dont_exist_should_raise_an_error
assert_raise
(
ActiveRecord
::
InverseOfAssociationNotFoundError
)
{
Face
.
first
.
horrible
_human
}
assert_raise
(
ActiveRecord
::
InverseOfAssociationNotFoundError
)
{
Face
.
first
.
puzzled
_human
}
end
def
test_building_has_many_parent_association_inverses_one_record
...
...
@@ -766,12 +766,12 @@ def test_with_has_many_inversing_does_not_trigger_association_callbacks_on_set_w
def
test_trying_to_access_inverses_that_dont_exist_shouldnt_raise_an_error
# Ideally this would, if only for symmetry's sake with other association types
assert_nothing_raised
{
Face
.
first
.
horrible
_polymorphic_human
}
assert_nothing_raised
{
Face
.
first
.
puzzled
_polymorphic_human
}
end
def
test_trying_to_set_polymorphic_inverses_that_dont_exist_at_all_should_raise_an_error
# fails because no class has the correct inverse_of for
horrible
_polymorphic_human
assert_raise
(
ActiveRecord
::
InverseOfAssociationNotFoundError
)
{
Face
.
first
.
horrible
_polymorphic_human
=
Human
.
first
}
# fails because no class has the correct inverse_of for
puzzled
_polymorphic_human
assert_raise
(
ActiveRecord
::
InverseOfAssociationNotFoundError
)
{
Face
.
first
.
puzzled
_polymorphic_human
=
Human
.
first
}
end
def
test_trying_to_set_polymorphic_inverses_that_dont_exist_on_the_instance_being_set_should_raise_an_error
...
...
activerecord/test/models/face.rb
浏览文件 @
34c54f96
...
...
@@ -7,8 +7,8 @@ class Face < ActiveRecord::Base
# Oracle identifier length is limited to 30 bytes or less, `polymorphic` renamed `poly`
belongs_to
:poly_human_without_inverse
,
polymorphic:
true
# These are "broken" inverse_of associations for the purposes of testing
belongs_to
:
horrible_human
,
class_name:
"Human"
,
inverse_of: :horrible
_face
belongs_to
:
horrible_polymorphic_human
,
polymorphic:
true
,
inverse_of: :horrible
_polymorphic_face
belongs_to
:
puzzled_human
,
class_name:
"Human"
,
inverse_of: :puzzled
_face
belongs_to
:
puzzled_polymorphic_human
,
polymorphic:
true
,
inverse_of: :puzzled
_polymorphic_face
validate
do
human
...
...
activerecord/test/models/human.rb
浏览文件 @
34c54f96
...
...
@@ -23,7 +23,7 @@ class Human < ActiveRecord::Base
after_add: :add_called
,
inverse_of: :polymorphic_human
# These are "broken" inverse_of associations for the purposes of testing
has_one
:
dirty_face
,
class_name:
"Face"
,
inverse_of: :dirty
_human
has_one
:
confused_face
,
class_name:
"Face"
,
inverse_of: :confused
_human
has_many
:secret_interests
,
class_name:
"Interest"
,
inverse_of: :secret_human
has_one
:mixed_case_monkey
...
...
activerecord/test/schema/schema.rb
浏览文件 @
34c54f96
...
...
@@ -1020,8 +1020,8 @@
t
.
string
:polymorphic_human_type
t
.
integer
:poly_human_without_inverse_id
t
.
string
:poly_human_without_inverse_type
t
.
integer
:
horrible
_polymorphic_human_id
t
.
string
:
horrible
_polymorphic_human_type
t
.
integer
:
puzzled
_polymorphic_human_id
t
.
string
:
puzzled
_polymorphic_human_type
t
.
references
:super_human
,
polymorphic:
true
,
index:
false
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录