Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
edee2c7b
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 搜索 >>
提交
edee2c7b
编写于
6月 05, 2012
作者:
A
Akira Matsuda
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
stop `to_s`ing method names
Module#methods are Symbols in Ruby >= 1.9
上级
9fb70033
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
21 addition
and
24 deletion
+21
-24
actionpack/test/controller/helper_test.rb
actionpack/test/controller/helper_test.rb
+16
-16
activerecord/test/cases/finder_respond_to_test.rb
activerecord/test/cases/finder_respond_to_test.rb
+1
-2
activerecord/test/cases/finder_test.rb
activerecord/test/cases/finder_test.rb
+1
-1
activesupport/lib/active_support/core_ext/date_time/conversions.rb
...port/lib/active_support/core_ext/date_time/conversions.rb
+1
-1
activesupport/lib/active_support/log_subscriber.rb
activesupport/lib/active_support/log_subscriber.rb
+1
-1
railties/test/railties/engine_test.rb
railties/test/railties/engine_test.rb
+1
-3
未找到文件。
actionpack/test/controller/helper_test.rb
浏览文件 @
edee2c7b
...
...
@@ -109,13 +109,13 @@ def test_helper
def
test_helper_method
assert_nothing_raised
{
@controller_class
.
helper_method
:delegate_method
}
assert
master_helper_methods
.
include?
(
'delegate_method'
)
assert
master_helper_methods
.
include?
(
:delegate_method
)
end
def
test_helper_attr
assert_nothing_raised
{
@controller_class
.
helper_attr
:delegate_attr
}
assert
master_helper_methods
.
include?
(
'delegate_attr'
)
assert
master_helper_methods
.
include?
(
'delegate_attr='
)
assert
master_helper_methods
.
include?
(
:delegate_attr
)
assert
master_helper_methods
.
include?
(
:delegate_attr
=
)
end
def
call_controller
(
klass
,
action
)
...
...
@@ -160,16 +160,16 @@ def test_lib_helper_methods_after_clear_helpers
end
def
test_all_helpers
methods
=
AllHelpersController
.
_helpers
.
instance_methods
.
map
{
|
m
|
m
.
to_s
}
methods
=
AllHelpersController
.
_helpers
.
instance_methods
# abc_helper.rb
assert
methods
.
include?
(
'bare_a'
)
assert
methods
.
include?
(
:bare_a
)
# fun/games_helper.rb
assert
methods
.
include?
(
'stratego'
)
assert
methods
.
include?
(
:stratego
)
# fun/pdf_helper.rb
assert
methods
.
include?
(
'foobar'
)
assert
methods
.
include?
(
:foobar
)
end
def
test_all_helpers_with_alternate_helper_dir
...
...
@@ -180,35 +180,35 @@ def test_all_helpers_with_alternate_helper_dir
@controller_class
.
helper
:all
# helpers/abc_helper.rb should not be included
assert
!
master_helper_methods
.
include?
(
'bare_a'
)
assert
!
master_helper_methods
.
include?
(
:bare_a
)
# alternate_helpers/foo_helper.rb
assert
master_helper_methods
.
include?
(
'baz'
)
assert
master_helper_methods
.
include?
(
:baz
)
end
def
test_helper_proxy
methods
=
AllHelpersController
.
helpers
.
methods
.
map
(
&
:to_s
)
methods
=
AllHelpersController
.
helpers
.
methods
# Action View
assert
methods
.
include?
(
'pluralize'
)
assert
methods
.
include?
(
:pluralize
)
# abc_helper.rb
assert
methods
.
include?
(
'bare_a'
)
assert
methods
.
include?
(
:bare_a
)
# fun/games_helper.rb
assert
methods
.
include?
(
'stratego'
)
assert
methods
.
include?
(
:stratego
)
# fun/pdf_helper.rb
assert
methods
.
include?
(
'foobar'
)
assert
methods
.
include?
(
:foobar
)
end
private
def
expected_helper_methods
TestHelper
.
instance_methods
.
map
{
|
m
|
m
.
to_s
}
TestHelper
.
instance_methods
end
def
master_helper_methods
@controller_class
.
_helpers
.
instance_methods
.
map
{
|
m
|
m
.
to_s
}
@controller_class
.
_helpers
.
instance_methods
end
def
missing_methods
...
...
activerecord/test/cases/finder_respond_to_test.rb
浏览文件 @
edee2c7b
...
...
@@ -80,7 +80,6 @@ def test_should_not_respond_to_find_by_invalid_method_syntax
private
def
ensure_topic_method_is_not_cached
(
method_id
)
class
<<
Topic
;
self
;
end
.
send
(
:remove_method
,
method_id
)
if
Topic
.
public_methods
.
any?
{
|
m
|
m
.
to_s
==
method_id
.
to_s
}
class
<<
Topic
;
self
;
end
.
send
(
:remove_method
,
method_id
)
if
Topic
.
public_methods
.
include?
method_id
end
end
activerecord/test/cases/finder_test.rb
浏览文件 @
edee2c7b
...
...
@@ -629,7 +629,7 @@ def test_find_by_two_attributes_with_one_being_an_aggregate
def
test_dynamic_finder_on_one_attribute_with_conditions_returns_same_results_after_caching
# ensure this test can run independently of order
class
<<
Account
;
self
;
end
.
send
(
:remove_method
,
:find_by_credit_limit
)
if
Account
.
public_methods
.
any?
{
|
m
|
m
.
to_s
==
'find_by_credit_limit'
}
class
<<
Account
;
self
;
end
.
send
(
:remove_method
,
:find_by_credit_limit
)
if
Account
.
public_methods
.
include?
(
:find_by_credit_limit
)
a
=
Account
.
where
(
'firm_id = ?'
,
6
).
find_by_credit_limit
(
50
)
assert_equal
a
,
Account
.
where
(
'firm_id = ?'
,
6
).
find_by_credit_limit
(
50
)
# find_by_credit_limit has been cached
end
...
...
activesupport/lib/active_support/core_ext/date_time/conversions.rb
浏览文件 @
edee2c7b
...
...
@@ -39,7 +39,7 @@ def to_formatted_s(format = :default)
to_default_s
end
end
alias_method
:to_default_s
,
:to_s
unless
(
instance_methods
(
false
)
&
[
:to_s
,
'to_s'
]).
empty?
alias_method
:to_default_s
,
:to_s
if
instance_methods
(
false
).
include?
(
:to_s
)
alias_method
:to_s
,
:to_formatted_s
#
...
...
activesupport/lib/active_support/log_subscriber.rb
浏览文件 @
edee2c7b
...
...
@@ -61,7 +61,7 @@ def attach_to(namespace, log_subscriber=new, notifier=ActiveSupport::Notificatio
@@flushable_loggers
=
nil
log_subscriber
.
public_methods
(
false
).
each
do
|
event
|
next
if
'call'
==
event
.
to_s
next
if
:call
==
event
notifier
.
subscribe
(
"
#{
event
}
.
#{
namespace
}
"
,
log_subscriber
)
end
...
...
railties/test/railties/engine_test.rb
浏览文件 @
edee2c7b
...
...
@@ -1009,9 +1009,7 @@ def baz
boot_rails
methods
=
Bukkits
::
Engine
.
helpers
.
public_instance_methods
.
collect
(
&
:to_s
).
sort
expected
=
[
"bar"
,
"baz"
]
assert_equal
expected
,
methods
assert_equal
[
:bar
,
:baz
],
Bukkits
::
Engine
.
helpers
.
public_instance_methods
.
sort
end
test
"setting priority for engines with config.railties_order"
do
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录