Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
50be1d0d
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,发现更多精彩内容 >>
提交
50be1d0d
编写于
2月 26, 2014
作者:
Y
Yves Senn
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
move PostgreSQL UUID tests from `datatype_test.rb` to `uuid_test.rb`.
上级
be97499b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
36 addition
and
16 deletion
+36
-16
activerecord/test/cases/adapters/postgresql/datatype_test.rb
activerecord/test/cases/adapters/postgresql/datatype_test.rb
+1
-16
activerecord/test/cases/adapters/postgresql/uuid_test.rb
activerecord/test/cases/adapters/postgresql/uuid_test.rb
+35
-0
未找到文件。
activerecord/test/cases/adapters/postgresql/datatype_test.rb
浏览文件 @
50be1d0d
...
...
@@ -27,9 +27,6 @@ class PostgresqlOid < ActiveRecord::Base
class
PostgresqlTimestampWithZone
<
ActiveRecord
::
Base
end
class
PostgresqlUUID
<
ActiveRecord
::
Base
end
class
PostgresqlLtree
<
ActiveRecord
::
Base
end
...
...
@@ -68,14 +65,11 @@ def setup
@first_oid
=
PostgresqlOid
.
find
(
1
)
@connection
.
execute
(
"INSERT INTO postgresql_timestamp_with_zones (id, time) VALUES (1, '2010-01-01 10:00:00-1')"
)
@connection
.
execute
(
"INSERT INTO postgresql_uuids (id, guid, compact_guid) VALUES(1, 'd96c3da0-96c1-012f-1316-64ce8f32c6d8', 'f06c715096c1012f131764ce8f32c6d8')"
)
@first_uuid
=
PostgresqlUUID
.
find
(
1
)
end
def
teardown
[
PostgresqlArray
,
PostgresqlTsvector
,
PostgresqlMoney
,
PostgresqlNumber
,
PostgresqlTime
,
PostgresqlNetworkAddress
,
PostgresqlBitString
,
PostgresqlOid
,
PostgresqlTimestampWithZone
,
PostgresqlUUID
].
each
(
&
:delete_all
)
PostgresqlBitString
,
PostgresqlOid
,
PostgresqlTimestampWithZone
].
each
(
&
:delete_all
)
end
def
test_array_escaping
...
...
@@ -124,10 +118,6 @@ def test_data_type_of_oid_types
assert_equal
:integer
,
@first_oid
.
column_for_attribute
(
:obj_id
).
type
end
def
test_data_type_of_uuid_types
assert_equal
:uuid
,
@first_uuid
.
column_for_attribute
(
:guid
).
type
end
def
test_array_values
assert_equal
[
35000
,
21000
,
18000
,
17000
],
@first_array
.
commission_by_quarter
assert_equal
[
'foo'
,
'bar'
,
'baz'
],
@first_array
.
nicknames
...
...
@@ -180,11 +170,6 @@ def test_network_address_values_ipaddr
assert_equal
'01:23:45:67:89:0a'
,
@first_network_address
.
mac_address
end
def
test_uuid_values
assert_equal
'd96c3da0-96c1-012f-1316-64ce8f32c6d8'
,
@first_uuid
.
guid
assert_equal
'f06c7150-96c1-012f-1317-64ce8f32c6d8'
,
@first_uuid
.
compact_guid
end
def
test_bit_string_values
assert_equal
'00010101'
,
@first_bit_string
.
bit_string
assert_equal
'00010101'
,
@first_bit_string
.
bit_string_varying
...
...
activerecord/test/cases/adapters/postgresql/uuid_test.rb
浏览文件 @
50be1d0d
...
...
@@ -5,6 +5,41 @@
require
'active_record/connection_adapters/postgresql_adapter'
class
PostgresqlUUIDTest
<
ActiveRecord
::
TestCase
class
UUIDType
<
ActiveRecord
::
Base
self
.
table_name
=
"uuid_data_type"
end
def
setup
@connection
=
ActiveRecord
::
Base
.
connection
@connection
.
transaction
do
@connection
.
create_table
"uuid_data_type"
do
|
t
|
t
.
uuid
'guid'
end
end
end
def
teardown
@connection
.
execute
'drop table if exists uuid_data_type'
end
def
test_data_type_of_uuid_types
assert_equal
:uuid
,
UUIDType
.
columns_hash
[
"guid"
].
type
end
def
test_uuid_formats
[
"A0EEBC99-9C0B-4EF8-BB6D-6BB9BD380A11"
,
"{a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11}"
,
"a0eebc999c0b4ef8bb6d6bb9bd380a11"
,
"a0ee-bc99-9c0b-4ef8-bb6d-6bb9-bd38-0a11"
,
"{a0eebc99-9c0b4ef8-bb6d6bb9-bd380a11}"
].
each
do
|
valid_uuid
|
UUIDType
.
create
(
guid:
valid_uuid
)
uuid
=
UUIDType
.
last
assert_equal
"a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11"
,
uuid
.
guid
end
end
end
class
PostgresqlUUIDGenerationTest
<
ActiveRecord
::
TestCase
class
UUID
<
ActiveRecord
::
Base
self
.
table_name
=
'pg_uuids'
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录