Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
3fc37e8e
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 搜索 >>
提交
3fc37e8e
编写于
5月 02, 2011
作者:
J
José Valim
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix failing AR test.
上级
de916632
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
12 addition
and
17 deletion
+12
-17
activerecord/test/cases/identity_map_test.rb
activerecord/test/cases/identity_map_test.rb
+0
-17
activerecord/test/cases/log_subscriber_test.rb
activerecord/test/cases/log_subscriber_test.rb
+12
-0
未找到文件。
activerecord/test/cases/identity_map_test.rb
浏览文件 @
3fc37e8e
require
"cases/helper"
require
"active_support/log_subscriber/test_helper"
require
'models/developer'
require
'models/project'
...
...
@@ -28,8 +27,6 @@ class IdentityMapTest < ActiveRecord::TestCase
:developers_projects
,
:computers
,
:authors
,
:author_addresses
,
:posts
,
:tags
,
:taggings
,
:comments
,
:subscribers
include
ActiveSupport
::
LogSubscriber
::
TestHelper
##############################################################################
# Basic tests checking if IM is functioning properly on basic find operations#
##############################################################################
...
...
@@ -386,20 +383,6 @@ def test_find_using_select_and_identity_map
assert_not_nil
post
.
title
end
def
test_log
# FIXME: Can't seem to figure out why it isn't logging in test, works fine in a real app
pending
"LogSubscriber wonkiness"
@old_logger
=
ActiveRecord
::
Base
.
logger
ActiveRecord
::
LogSubscriber
.
attach_to
(
:active_record
)
Post
.
find
1
Post
.
find
1
assert_match
(
/From Identity Map/
,
@logger
.
logged
(
:debug
).
last
)
ensure
ActiveRecord
::
LogSubscriber
.
log_subscribers
.
pop
ActiveRecord
::
Base
.
logger
=
@old_logger
end
# Currently AR is not allowing changing primary key (see Persistence#update)
# So we ignore it. If this changes, this test needs to be uncommented.
# def test_updating_of_pkey
...
...
activerecord/test/cases/log_subscriber_test.rb
浏览文件 @
3fc37e8e
require
"cases/helper"
require
"models/developer"
require
"models/post"
require
"active_support/log_subscriber/test_helper"
class
LogSubscriberTest
<
ActiveRecord
::
TestCase
include
ActiveSupport
::
LogSubscriber
::
TestHelper
include
ActiveSupport
::
BufferedLogger
::
Severity
fixtures
:posts
def
setup
@old_logger
=
ActiveRecord
::
Base
.
logger
@using_identity_map
=
ActiveRecord
::
IdentityMap
.
enabled?
...
...
@@ -91,4 +94,13 @@ def test_cached_queries_doesnt_log_when_level_is_not_debug
def
test_initializes_runtime
Thread
.
new
{
assert_equal
0
,
ActiveRecord
::
LogSubscriber
.
runtime
}.
join
end
def
test_log
ActiveRecord
::
IdentityMap
.
use
do
Post
.
find
1
Post
.
find
1
end
wait
assert_match
(
/From Identity Map/
,
@logger
.
logged
(
:debug
).
last
)
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录