Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
f4434606
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,发现更多精彩内容 >>
提交
f4434606
编写于
7月 02, 2017
作者:
K
Kasper Timm Hansen
提交者:
GitHub
7月 02, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #29658 from kamipo/remove_redundant_assert_respond_to
Remove redundant `assert_respond_to`
上级
6642b112
6aa658e3
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
3 addition
and
42 deletion
+3
-42
actioncable/test/subscription_adapter/base_test.rb
actioncable/test/subscription_adapter/base_test.rb
+3
-13
activerecord/test/cases/associations/inverse_associations_test.rb
...cord/test/cases/associations/inverse_associations_test.rb
+0
-26
railties/test/application/configuration_test.rb
railties/test/application/configuration_test.rb
+0
-3
未找到文件。
actioncable/test/subscription_adapter/base_test.rb
浏览文件 @
f4434606
...
...
@@ -39,35 +39,25 @@ class BrokenAdapter < ActionCable::SubscriptionAdapter::Base
# TEST METHODS THAT ARE REQUIRED OF THE ADAPTER'S BACKEND STORAGE OBJECT
test
"#broadcast is implemented"
do
broadcast
=
SuccessAdapter
.
new
(
@server
).
broadcast
(
"channel"
,
"payload"
)
assert_respond_to
(
SuccessAdapter
.
new
(
@server
),
:broadcast
)
assert_nothing_raised
do
broadcast
SuccessAdapter
.
new
(
@server
).
broadcast
(
"channel"
,
"payload"
)
end
end
test
"#subscribe is implemented"
do
callback
=
lambda
{
puts
"callback"
}
success_callback
=
lambda
{
puts
"success"
}
subscribe
=
SuccessAdapter
.
new
(
@server
).
subscribe
(
"channel"
,
callback
,
success_callback
)
assert_respond_to
(
SuccessAdapter
.
new
(
@server
),
:subscribe
)
assert_nothing_raised
do
subscribe
SuccessAdapter
.
new
(
@server
).
subscribe
(
"channel"
,
callback
,
success_callback
)
end
end
test
"#unsubscribe is implemented"
do
callback
=
lambda
{
puts
"callback"
}
unsubscribe
=
SuccessAdapter
.
new
(
@server
).
unsubscribe
(
"channel"
,
callback
)
assert_respond_to
(
SuccessAdapter
.
new
(
@server
),
:unsubscribe
)
assert_nothing_raised
do
unsubscribe
SuccessAdapter
.
new
(
@server
).
unsubscribe
(
"channel"
,
callback
)
end
end
end
activerecord/test/cases/associations/inverse_associations_test.rb
浏览文件 @
f4434606
...
...
@@ -24,11 +24,9 @@ def test_has_one_and_belongs_to_should_find_inverse_automatically_on_multiple_wo
monkey_reflection
=
MixedCaseMonkey
.
reflect_on_association
(
:man
)
man_reflection
=
Man
.
reflect_on_association
(
:mixed_case_monkey
)
assert_respond_to
monkey_reflection
,
:has_inverse?
assert
monkey_reflection
.
has_inverse?
,
"The monkey reflection should have an inverse"
assert_equal
man_reflection
,
monkey_reflection
.
inverse_of
,
"The monkey reflection's inverse should be the man reflection"
assert_respond_to
man_reflection
,
:has_inverse?
assert
man_reflection
.
has_inverse?
,
"The man reflection should have an inverse"
assert_equal
monkey_reflection
,
man_reflection
.
inverse_of
,
"The man reflection's inverse should be the monkey reflection"
end
...
...
@@ -37,7 +35,6 @@ def test_has_many_and_belongs_to_should_find_inverse_automatically_for_model_in_
account_reflection
=
Admin
::
Account
.
reflect_on_association
(
:users
)
user_reflection
=
Admin
::
User
.
reflect_on_association
(
:account
)
assert_respond_to
account_reflection
,
:has_inverse?
assert
account_reflection
.
has_inverse?
,
"The Admin::Account reflection should have an inverse"
assert_equal
user_reflection
,
account_reflection
.
inverse_of
,
"The Admin::Account reflection's inverse should be the Admin::User reflection"
end
...
...
@@ -46,11 +43,9 @@ def test_has_one_and_belongs_to_should_find_inverse_automatically
car_reflection
=
Car
.
reflect_on_association
(
:bulb
)
bulb_reflection
=
Bulb
.
reflect_on_association
(
:car
)
assert_respond_to
car_reflection
,
:has_inverse?
assert
car_reflection
.
has_inverse?
,
"The Car reflection should have an inverse"
assert_equal
bulb_reflection
,
car_reflection
.
inverse_of
,
"The Car reflection's inverse should be the Bulb reflection"
assert_respond_to
bulb_reflection
,
:has_inverse?
assert
bulb_reflection
.
has_inverse?
,
"The Bulb reflection should have an inverse"
assert_equal
car_reflection
,
bulb_reflection
.
inverse_of
,
"The Bulb reflection's inverse should be the Car reflection"
end
...
...
@@ -59,7 +54,6 @@ def test_has_many_and_belongs_to_should_find_inverse_automatically
comment_reflection
=
Comment
.
reflect_on_association
(
:ratings
)
rating_reflection
=
Rating
.
reflect_on_association
(
:comment
)
assert_respond_to
comment_reflection
,
:has_inverse?
assert
comment_reflection
.
has_inverse?
,
"The Comment reflection should have an inverse"
assert_equal
rating_reflection
,
comment_reflection
.
inverse_of
,
"The Comment reflection's inverse should be the Rating reflection"
end
...
...
@@ -107,19 +101,16 @@ def test_has_many_and_belongs_to_automatic_inverse_shares_objects_on_comment
def
test_polymorphic_and_has_many_through_relationships_should_not_have_inverses
sponsor_reflection
=
Sponsor
.
reflect_on_association
(
:sponsorable
)
assert_respond_to
sponsor_reflection
,
:has_inverse?
assert
!
sponsor_reflection
.
has_inverse?
,
"A polymorphic association should not find an inverse automatically"
club_reflection
=
Club
.
reflect_on_association
(
:members
)
assert_respond_to
club_reflection
,
:has_inverse?
assert
!
club_reflection
.
has_inverse?
,
"A has_many_through association should not find an inverse automatically"
end
def
test_polymorphic_has_one_should_find_inverse_automatically
man_reflection
=
Man
.
reflect_on_association
(
:polymorphic_face_without_inverse
)
assert_respond_to
man_reflection
,
:has_inverse?
assert
man_reflection
.
has_inverse?
end
end
...
...
@@ -141,41 +132,24 @@ def test_should_allow_for_inverse_of_options_in_associations
def
test_should_be_able_to_ask_a_reflection_if_it_has_an_inverse
has_one_with_inverse_ref
=
Man
.
reflect_on_association
(
:face
)
assert_respond_to
has_one_with_inverse_ref
,
:has_inverse?
assert
has_one_with_inverse_ref
.
has_inverse?
has_many_with_inverse_ref
=
Man
.
reflect_on_association
(
:interests
)
assert_respond_to
has_many_with_inverse_ref
,
:has_inverse?
assert
has_many_with_inverse_ref
.
has_inverse?
belongs_to_with_inverse_ref
=
Face
.
reflect_on_association
(
:man
)
assert_respond_to
belongs_to_with_inverse_ref
,
:has_inverse?
assert
belongs_to_with_inverse_ref
.
has_inverse?
has_one_without_inverse_ref
=
Club
.
reflect_on_association
(
:sponsor
)
assert_respond_to
has_one_without_inverse_ref
,
:has_inverse?
assert
!
has_one_without_inverse_ref
.
has_inverse?
has_many_without_inverse_ref
=
Club
.
reflect_on_association
(
:memberships
)
assert_respond_to
has_many_without_inverse_ref
,
:has_inverse?
assert
!
has_many_without_inverse_ref
.
has_inverse?
belongs_to_without_inverse_ref
=
Sponsor
.
reflect_on_association
(
:sponsor_club
)
assert_respond_to
belongs_to_without_inverse_ref
,
:has_inverse?
assert
!
belongs_to_without_inverse_ref
.
has_inverse?
end
def
test_should_be_able_to_ask_a_reflection_what_it_is_the_inverse_of
has_one_ref
=
Man
.
reflect_on_association
(
:face
)
assert_respond_to
has_one_ref
,
:inverse_of
has_many_ref
=
Man
.
reflect_on_association
(
:interests
)
assert_respond_to
has_many_ref
,
:inverse_of
belongs_to_ref
=
Face
.
reflect_on_association
(
:man
)
assert_respond_to
belongs_to_ref
,
:inverse_of
end
def
test_inverse_of_method_should_supply_the_actual_reflection_instance_it_is_the_inverse_of
has_one_ref
=
Man
.
reflect_on_association
(
:face
)
assert_equal
Face
.
reflect_on_association
(
:man
),
has_one_ref
.
inverse_of
...
...
railties/test/application/configuration_test.rb
浏览文件 @
f4434606
...
...
@@ -176,13 +176,11 @@ def change
test
"Rails.application responds to all instance methods"
do
app
"development"
assert_respond_to
Rails
.
application
,
:routes_reloader
assert_equal
Rails
.
application
.
routes_reloader
,
AppTemplate
::
Application
.
routes_reloader
end
test
"Rails::Application responds to paths"
do
app
"development"
assert_respond_to
AppTemplate
::
Application
,
:paths
assert_equal
[
"
#{
app_path
}
/app/views"
],
AppTemplate
::
Application
.
paths
[
"app/views"
].
expanded
end
...
...
@@ -1220,7 +1218,6 @@ def index
test
"Rails.application#env_config exists and include some existing parameters"
do
make_basic_app
assert_respond_to
app
,
:env_config
assert_equal
app
.
env_config
[
"action_dispatch.parameter_filter"
],
app
.
config
.
filter_parameters
assert_equal
app
.
env_config
[
"action_dispatch.show_exceptions"
],
app
.
config
.
action_dispatch
.
show_exceptions
assert_equal
app
.
env_config
[
"action_dispatch.logger"
],
Rails
.
logger
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录