Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
788f33fb
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,发现更多精彩内容 >>
提交
788f33fb
编写于
8月 16, 2010
作者:
M
Mike Dalessio
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TreeManager classes deep-copy their statements.
上级
0403efa4
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
49 addition
and
0 deletion
+49
-0
lib/arel/tree_manager.rb
lib/arel/tree_manager.rb
+5
-0
spec/arel/insert_manager_spec.rb
spec/arel/insert_manager_spec.rb
+11
-0
spec/arel/select_manager_spec.rb
spec/arel/select_manager_spec.rb
+11
-0
spec/arel/update_manager_spec.rb
spec/arel/update_manager_spec.rb
+12
-0
spec/spec_helper.rb
spec/spec_helper.rb
+1
-0
spec/support/shared/tree_manager_shared.rb
spec/support/shared/tree_manager_shared.rb
+9
-0
未找到文件。
lib/arel/tree_manager.rb
浏览文件 @
788f33fb
...
...
@@ -15,5 +15,10 @@ def to_sql
viz
=
Visitors
::
ToSql
.
new
@engine
viz
.
accept
@head
end
def
initialize_copy
other
super
@head
=
@head
.
clone
end
end
end
spec/arel/insert_manager_spec.rb
浏览文件 @
788f33fb
...
...
@@ -110,5 +110,16 @@ module Arel
}
end
end
describe
"TreeManager"
do
subject
do
table
=
Table
.
new
(
:users
)
Arel
::
InsertManager
.
new
(
Table
.
engine
).
tap
do
|
manager
|
manager
.
insert
[[
table
[
:id
],
nil
]]
end
end
it_should_behave_like
"TreeManager"
end
end
end
spec/arel/select_manager_spec.rb
浏览文件 @
788f33fb
...
...
@@ -166,5 +166,16 @@ def execute sql
manager
.
to_sql
.
should
be_like
'SELECT "users"."id" FROM "users"'
end
end
describe
"TreeManager"
do
subject
do
table
=
Table
.
new
:users
Arel
::
SelectManager
.
new
(
Table
.
engine
).
tap
do
|
manager
|
manager
.
from
(
table
).
project
(
table
[
'id'
])
end
end
it_should_behave_like
"TreeManager"
end
end
end
spec/arel/update_manager_spec.rb
浏览文件 @
788f33fb
...
...
@@ -73,5 +73,17 @@ module Arel
um
.
where
(
table
[
:id
].
eq
(
1
)).
should
==
um
end
end
describe
"TreeManager"
do
subject
do
table
=
Table
.
new
:users
Arel
::
UpdateManager
.
new
(
Table
.
engine
).
tap
do
|
manager
|
manager
.
table
table
manager
.
where
table
[
:id
].
eq
(
1
)
end
end
it_should_behave_like
"TreeManager"
end
end
end
spec/spec_helper.rb
浏览文件 @
788f33fb
...
...
@@ -5,6 +5,7 @@
require
'support/matchers/be_like'
require
'support/check'
Dir
[
File
.
join
(
File
.
dirname
(
__FILE__
),
'support/shared/*'
)].
each
{
|
f
|
require
f
}
if
adapter
=
ENV
[
'ADAPTER'
]
require
"support/connections/
#{
adapter
}
_connection.rb"
...
...
spec/support/shared/tree_manager_shared.rb
0 → 100644
浏览文件 @
788f33fb
shared_examples_for
"TreeManager"
do
describe
"clone"
do
it
"clones the insert statement"
do
subject
.
instance_variable_get
(
"@head"
).
should_receive
(
:clone
).
and_return
(
:foo
)
# TODO: ick.
dolly
=
subject
.
clone
dolly
.
instance_variable_get
(
"@head"
).
should
==
:foo
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录