Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
28bdb2ad
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,发现更多精彩内容 >>
提交
28bdb2ad
编写于
4月 25, 2017
作者:
R
Rafael França
提交者:
GitHub
4月 25, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #28853 from kamipo/replace_regexp_z
Replace \Z to \z
上级
7a1c00d4
0d171682
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
20 addition
and
20 deletion
+20
-20
activemodel/test/cases/validations/format_validation_test.rb
activemodel/test/cases/validations/format_validation_test.rb
+3
-3
activerecord/test/cases/collection_cache_key_test.rb
activerecord/test/cases/collection_cache_key_test.rb
+12
-12
activerecord/test/cases/persistence_test.rb
activerecord/test/cases/persistence_test.rb
+1
-1
activerecord/test/cases/relation/merging_test.rb
activerecord/test/cases/relation/merging_test.rb
+1
-1
railties/test/isolation/abstract_unit.rb
railties/test/isolation/abstract_unit.rb
+3
-3
未找到文件。
activemodel/test/cases/validations/format_validation_test.rb
浏览文件 @
28bdb2ad
...
...
@@ -107,7 +107,7 @@ def test_validates_format_of_when_not_isnt_a_regexp_should_raise_error
end
def
test_validates_format_of_with_lambda
Topic
.
validates_format_of
:content
,
with:
lambda
{
|
topic
|
topic
.
title
==
"digit"
?
/\A\d+\
Z/
:
/\A\S+\Z
/
}
Topic
.
validates_format_of
:content
,
with:
lambda
{
|
topic
|
topic
.
title
==
"digit"
?
/\A\d+\
z/
:
/\A\S+\z
/
}
t
=
Topic
.
new
t
.
title
=
"digit"
...
...
@@ -119,7 +119,7 @@ def test_validates_format_of_with_lambda
end
def
test_validates_format_of_without_lambda
Topic
.
validates_format_of
:content
,
without:
lambda
{
|
topic
|
topic
.
title
==
"characters"
?
/\A\d+\
Z/
:
/\A\S+\Z
/
}
Topic
.
validates_format_of
:content
,
without:
lambda
{
|
topic
|
topic
.
title
==
"characters"
?
/\A\d+\
z/
:
/\A\S+\z
/
}
t
=
Topic
.
new
t
.
title
=
"characters"
...
...
@@ -131,7 +131,7 @@ def test_validates_format_of_without_lambda
end
def
test_validates_format_of_for_ruby_class
Person
.
validates_format_of
:karma
,
with:
/\A\d+\
Z
/
Person
.
validates_format_of
:karma
,
with:
/\A\d+\
z
/
p
=
Person
.
new
p
.
karma
=
"Pixies"
...
...
activerecord/test/cases/collection_cache_key_test.rb
浏览文件 @
28bdb2ad
...
...
@@ -11,16 +11,16 @@ class CollectionCacheKeyTest < ActiveRecord::TestCase
fixtures
:developers
,
:projects
,
:developers_projects
,
:topics
,
:comments
,
:posts
test
"collection_cache_key on model"
do
assert_match
(
/\Adevelopers\/query-(\h+)-(\d+)-(\d+)\
Z
/
,
Developer
.
collection_cache_key
)
assert_match
(
/\Adevelopers\/query-(\h+)-(\d+)-(\d+)\
z
/
,
Developer
.
collection_cache_key
)
end
test
"cache_key for relation"
do
developers
=
Developer
.
where
(
salary:
100000
).
order
(
updated_at: :desc
)
last_developer_timestamp
=
developers
.
first
.
updated_at
assert_match
(
/\Adevelopers\/query-(\h+)-(\d+)-(\d+)\
Z
/
,
developers
.
cache_key
)
assert_match
(
/\Adevelopers\/query-(\h+)-(\d+)-(\d+)\
z
/
,
developers
.
cache_key
)
/\Adevelopers\/query-(\h+)-(\d+)-(\d+)\
Z
/
=~
developers
.
cache_key
/\Adevelopers\/query-(\h+)-(\d+)-(\d+)\
z
/
=~
developers
.
cache_key
assert_equal
Digest
::
MD5
.
hexdigest
(
developers
.
to_sql
),
$1
assert_equal
developers
.
count
.
to_s
,
$2
...
...
@@ -31,9 +31,9 @@ class CollectionCacheKeyTest < ActiveRecord::TestCase
developers
=
Developer
.
where
(
salary:
100000
).
order
(
updated_at: :desc
).
limit
(
5
)
last_developer_timestamp
=
developers
.
first
.
updated_at
assert_match
(
/\Adevelopers\/query-(\h+)-(\d+)-(\d+)\
Z
/
,
developers
.
cache_key
)
assert_match
(
/\Adevelopers\/query-(\h+)-(\d+)-(\d+)\
z
/
,
developers
.
cache_key
)
/\Adevelopers\/query-(\h+)-(\d+)-(\d+)\
Z
/
=~
developers
.
cache_key
/\Adevelopers\/query-(\h+)-(\d+)-(\d+)\
z
/
=~
developers
.
cache_key
assert_equal
Digest
::
MD5
.
hexdigest
(
developers
.
to_sql
),
$1
assert_equal
developers
.
count
.
to_s
,
$2
...
...
@@ -44,9 +44,9 @@ class CollectionCacheKeyTest < ActiveRecord::TestCase
developers
=
Developer
.
where
(
salary:
100000
).
order
(
updated_at: :desc
).
limit
(
5
).
load
last_developer_timestamp
=
developers
.
first
.
updated_at
assert_match
(
/\Adevelopers\/query-(\h+)-(\d+)-(\d+)\
Z
/
,
developers
.
cache_key
)
assert_match
(
/\Adevelopers\/query-(\h+)-(\d+)-(\d+)\
z
/
,
developers
.
cache_key
)
/\Adevelopers\/query-(\h+)-(\d+)-(\d+)\
Z
/
=~
developers
.
cache_key
/\Adevelopers\/query-(\h+)-(\d+)-(\d+)\
z
/
=~
developers
.
cache_key
assert_equal
Digest
::
MD5
.
hexdigest
(
developers
.
to_sql
),
$1
assert_equal
developers
.
count
.
to_s
,
$2
...
...
@@ -74,7 +74,7 @@ class CollectionCacheKeyTest < ActiveRecord::TestCase
test
"cache_key for empty relation"
do
developers
=
Developer
.
where
(
name:
"Non Existent Developer"
)
assert_match
(
/\Adevelopers\/query-(\h+)-0\
Z
/
,
developers
.
cache_key
)
assert_match
(
/\Adevelopers\/query-(\h+)-0\
z
/
,
developers
.
cache_key
)
end
test
"cache_key with custom timestamp column"
do
...
...
@@ -90,7 +90,7 @@ class CollectionCacheKeyTest < ActiveRecord::TestCase
test
"collection proxy provides a cache_key"
do
developers
=
projects
(
:active_record
).
developers
assert_match
(
/\Adevelopers\/query-(\h+)-(\d+)-(\d+)\
Z
/
,
developers
.
cache_key
)
assert_match
(
/\Adevelopers\/query-(\h+)-(\d+)-(\d+)\
z
/
,
developers
.
cache_key
)
end
test
"cache_key for loaded collection with zero size"
do
...
...
@@ -98,18 +98,18 @@ class CollectionCacheKeyTest < ActiveRecord::TestCase
posts
=
Post
.
includes
(
:comments
)
empty_loaded_collection
=
posts
.
first
.
comments
assert_match
(
/\Acomments\/query-(\h+)-0\
Z
/
,
empty_loaded_collection
.
cache_key
)
assert_match
(
/\Acomments\/query-(\h+)-0\
z
/
,
empty_loaded_collection
.
cache_key
)
end
test
"cache_key for queries with offset which return 0 rows"
do
developers
=
Developer
.
offset
(
20
)
assert_match
(
/\Adevelopers\/query-(\h+)-0\
Z
/
,
developers
.
cache_key
)
assert_match
(
/\Adevelopers\/query-(\h+)-0\
z
/
,
developers
.
cache_key
)
end
test
"cache_key with a relation having selected columns"
do
developers
=
Developer
.
select
(
:salary
)
assert_match
(
/\Adevelopers\/query-(\h+)-(\d+)-(\d+)\
Z
/
,
developers
.
cache_key
)
assert_match
(
/\Adevelopers\/query-(\h+)-(\d+)-(\d+)\
z
/
,
developers
.
cache_key
)
end
end
end
activerecord/test/cases/persistence_test.rb
浏览文件 @
28bdb2ad
...
...
@@ -49,7 +49,7 @@ def test_update_all_doesnt_ignore_order
assert
!
test_update_with_order_succeeds
.
call
(
"id ASC"
)
# test that this wasn't a fluke and using an incorrect order results in an exception
else
# test that we're failing because the current Arel's engine doesn't support UPDATE ORDER BY queries is using subselects instead
assert_sql
(
/\AUPDATE .+ \(SELECT .* ORDER BY id DESC\)\
Z
/i
)
do
assert_sql
(
/\AUPDATE .+ \(SELECT .* ORDER BY id DESC\)\
z
/i
)
do
test_update_with_order_succeeds
.
call
(
"id DESC"
)
end
end
...
...
activerecord/test/cases/relation/merging_test.rb
浏览文件 @
28bdb2ad
...
...
@@ -21,7 +21,7 @@ def test_relation_merging
def
test_relation_to_sql
post
=
Post
.
first
sql
=
post
.
comments
.
to_sql
assert_match
(
/.?post_id.? =
#{
post
.
id
}
\
Z
/i
,
sql
)
assert_match
(
/.?post_id.? =
#{
post
.
id
}
\
z
/i
,
sql
)
end
def
test_relation_merging_with_arel_equalities_keeps_last_equality
...
...
railties/test/isolation/abstract_unit.rb
浏览文件 @
28bdb2ad
...
...
@@ -119,7 +119,7 @@ def build_app(options = {})
end
routes
=
File
.
read
(
"
#{
app_path
}
/config/routes.rb"
)
if
routes
=~
/(\n\s*end\s*)\
Z
/
if
routes
=~
/(\n\s*end\s*)\
z
/
File
.
open
(
"
#{
app_path
}
/config/routes.rb"
,
"w"
)
do
|
f
|
f
.
puts
$`
+
"
\n
ActiveSupport::Deprecation.silence { match ':controller(/:action(/:id))(.:format)', via: :all }
\n
"
+
$1
end
...
...
@@ -251,7 +251,7 @@ def add_to_top_of_config(str)
def
add_to_config
(
str
)
environment
=
File
.
read
(
"
#{
app_path
}
/config/application.rb"
)
if
environment
=~
/(\n\s*end\s*end\s*)\
Z
/
if
environment
=~
/(\n\s*end\s*end\s*)\
z
/
File
.
open
(
"
#{
app_path
}
/config/application.rb"
,
"w"
)
do
|
f
|
f
.
puts
$`
+
"
\n
#{
str
}
\n
"
+
$1
end
...
...
@@ -260,7 +260,7 @@ def add_to_config(str)
def
add_to_env_config
(
env
,
str
)
environment
=
File
.
read
(
"
#{
app_path
}
/config/environments/
#{
env
}
.rb"
)
if
environment
=~
/(\n\s*end\s*)\
Z
/
if
environment
=~
/(\n\s*end\s*)\
z
/
File
.
open
(
"
#{
app_path
}
/config/environments/
#{
env
}
.rb"
,
"w"
)
do
|
f
|
f
.
puts
$`
+
"
\n
#{
str
}
\n
"
+
$1
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录