Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
8fdd2eae
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,发现更多精彩内容 >>
提交
8fdd2eae
编写于
1月 04, 2014
作者:
A
Aaron Ackerman
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Removed EngineProxy in SelectManager tests
上级
1b084a82
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
8 addition
and
68 deletion
+8
-68
test/test_select_manager.rb
test/test_select_manager.rb
+8
-68
未找到文件。
test/test_select_manager.rb
浏览文件 @
8fdd2eae
require
'helper'
module
Arel
class
EngineProxy
attr_reader
:executed
attr_reader
:connection_pool
attr_reader
:spec
attr_reader
:config
def
initialize
engine
@engine
=
engine
@executed
=
[]
@connection_pool
=
self
@spec
=
self
@config
=
{
:adapter
=>
'sqlite3'
}
end
def
with_connection
yield
self
end
def
connection
self
end
def
quote_table_name
thing
;
@engine
.
connection
.
quote_table_name
thing
end
def
quote_column_name
thing
;
@engine
.
connection
.
quote_column_name
thing
end
def
quote
thing
,
column
;
@engine
.
connection
.
quote
thing
,
column
end
def
columns
table
,
message
=
nil
@engine
.
connection
.
columns
table
,
message
end
def
columns_hash
@engine
.
connection
.
columns_hash
end
def
table_exists?
name
@engine
.
connection
.
table_exists?
name
end
def
tables
@engine
.
connection
.
tables
end
def
visitor
@engine
.
connection
.
visitor
end
def
execute
sql
,
name
=
nil
,
*
args
@executed
<<
sql
end
alias
:update
:execute
alias
:delete
:execute
alias
:insert
:execute
end
describe
'select manager'
do
def
test_join_sources
...
...
@@ -874,9 +822,8 @@ def test_join_sources
describe
'delete'
do
it
"copies from"
do
engine
=
EngineProxy
.
new
Table
.
engine
table
=
Table
.
new
:users
manager
=
Arel
::
SelectManager
.
new
engine
manager
=
Arel
::
SelectManager
.
new
Table
.
engine
manager
.
from
table
stmt
=
manager
.
compile_delete
...
...
@@ -884,9 +831,8 @@ def test_join_sources
end
it
"copies where"
do
engine
=
EngineProxy
.
new
Table
.
engine
table
=
Table
.
new
:users
manager
=
Arel
::
SelectManager
.
new
engine
manager
=
Arel
::
SelectManager
.
new
Table
.
engine
manager
.
from
table
manager
.
where
table
[
:id
].
eq
10
stmt
=
manager
.
compile_delete
...
...
@@ -916,9 +862,8 @@ def test_join_sources
describe
'update'
do
it
'copies limits'
do
engine
=
EngineProxy
.
new
Table
.
engine
table
=
Table
.
new
:users
manager
=
Arel
::
SelectManager
.
new
engine
manager
=
Arel
::
SelectManager
.
new
Table
.
engine
manager
.
from
table
manager
.
take
1
stmt
=
manager
.
compile_update
(
SqlLiteral
.
new
(
'foo = bar'
),
Arel
::
Attributes
::
Attribute
.
new
(
table
,
'id'
))
...
...
@@ -931,9 +876,8 @@ def test_join_sources
end
it
'copies order'
do
engine
=
EngineProxy
.
new
Table
.
engine
table
=
Table
.
new
:users
manager
=
Arel
::
SelectManager
.
new
engine
manager
=
Arel
::
SelectManager
.
new
Table
.
engine
manager
.
from
table
manager
.
order
:foo
stmt
=
manager
.
compile_update
(
SqlLiteral
.
new
(
'foo = bar'
),
Arel
::
Attributes
::
Attribute
.
new
(
table
,
'id'
))
...
...
@@ -946,9 +890,8 @@ def test_join_sources
end
it
'takes a string'
do
engine
=
EngineProxy
.
new
Table
.
engine
table
=
Table
.
new
:users
manager
=
Arel
::
SelectManager
.
new
engine
manager
=
Arel
::
SelectManager
.
new
Table
.
engine
manager
.
from
table
stmt
=
manager
.
compile_update
(
SqlLiteral
.
new
(
'foo = bar'
),
Arel
::
Attributes
::
Attribute
.
new
(
table
,
'id'
))
...
...
@@ -956,9 +899,8 @@ def test_join_sources
end
it
'copies where clauses'
do
engine
=
EngineProxy
.
new
Table
.
engine
table
=
Table
.
new
:users
manager
=
Arel
::
SelectManager
.
new
engine
manager
=
Arel
::
SelectManager
.
new
Table
.
engine
manager
.
where
table
[
:id
].
eq
10
manager
.
from
table
stmt
=
manager
.
compile_update
({
table
[
:id
]
=>
1
},
Arel
::
Attributes
::
Attribute
.
new
(
table
,
'id'
))
...
...
@@ -969,9 +911,8 @@ def test_join_sources
end
it
'copies where clauses when nesting is triggered'
do
engine
=
EngineProxy
.
new
Table
.
engine
table
=
Table
.
new
:users
manager
=
Arel
::
SelectManager
.
new
engine
manager
=
Arel
::
SelectManager
.
new
Table
.
engine
manager
.
where
table
[
:foo
].
eq
10
manager
.
take
42
manager
.
from
table
...
...
@@ -983,9 +924,8 @@ def test_join_sources
end
it
'executes an update statement'
do
engine
=
EngineProxy
.
new
Table
.
engine
table
=
Table
.
new
:users
manager
=
Arel
::
SelectManager
.
new
engine
manager
=
Arel
::
SelectManager
.
new
Table
.
engine
manager
.
from
table
stmt
=
manager
.
compile_update
({
table
[
:id
]
=>
1
},
Arel
::
Attributes
::
Attribute
.
new
(
table
,
'id'
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录