Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
211adb47
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,发现更多精彩内容 >>
提交
211adb47
编写于
1月 24, 2018
作者:
D
Daniel Colson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Change refute to assert_not
上级
0d50cae9
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
51 addition
and
51 deletion
+51
-51
actioncable/test/channel/stream_test.rb
actioncable/test/channel/stream_test.rb
+1
-1
actionpack/test/controller/metal_test.rb
actionpack/test/controller/metal_test.rb
+3
-3
actionpack/test/controller/parameters/accessors_test.rb
actionpack/test/controller/parameters/accessors_test.rb
+6
-6
actionpack/test/controller/parameters/parameters_permit_test.rb
...pack/test/controller/parameters/parameters_permit_test.rb
+3
-3
activemodel/test/cases/attribute_test.rb
activemodel/test/cases/attribute_test.rb
+3
-3
activerecord/test/cases/adapters/postgresql/array_test.rb
activerecord/test/cases/adapters/postgresql/array_test.rb
+1
-1
activerecord/test/cases/adapters/postgresql/hstore_test.rb
activerecord/test/cases/adapters/postgresql/hstore_test.rb
+2
-2
activerecord/test/cases/attributes_test.rb
activerecord/test/cases/attributes_test.rb
+2
-2
activerecord/test/cases/base_test.rb
activerecord/test/cases/base_test.rb
+1
-1
activerecord/test/cases/dirty_test.rb
activerecord/test/cases/dirty_test.rb
+7
-7
activerecord/test/cases/locking_test.rb
activerecord/test/cases/locking_test.rb
+1
-1
activerecord/test/cases/migration/foreign_key_test.rb
activerecord/test/cases/migration/foreign_key_test.rb
+5
-5
activerecord/test/cases/migration/rename_table_test.rb
activerecord/test/cases/migration/rename_table_test.rb
+2
-2
activerecord/test/cases/query_cache_test.rb
activerecord/test/cases/query_cache_test.rb
+7
-7
activerecord/test/cases/relation/merging_test.rb
activerecord/test/cases/relation/merging_test.rb
+1
-1
activerecord/test/cases/serialized_attribute_test.rb
activerecord/test/cases/serialized_attribute_test.rb
+1
-1
activerecord/test/cases/validations/uniqueness_validation_test.rb
...cord/test/cases/validations/uniqueness_validation_test.rb
+2
-2
activesupport/test/core_ext/class_test.rb
activesupport/test/core_ext/class_test.rb
+2
-2
railties/test/application/configuration_test.rb
railties/test/application/configuration_test.rb
+1
-1
未找到文件。
actioncable/test/channel/stream_test.rb
浏览文件 @
211adb47
...
...
@@ -167,7 +167,7 @@ class StreamFromTest < ActionCable::TestCase
@server
.
broadcast
"channel"
,
{}
wait_for_async
refute
Thread
.
current
[
:ran_callback
],
"User callback was not run through the worker pool"
assert_not
Thread
.
current
[
:ran_callback
],
"User callback was not run through the worker pool"
end
end
...
...
actionpack/test/controller/metal_test.rb
浏览文件 @
211adb47
...
...
@@ -23,9 +23,9 @@ def test_response_does_not_have_default_headers
"rack.input"
=>
->
{}
)[
1
]
refute
response_headers
.
key?
(
"X-Frame-Options"
)
refute
response_headers
.
key?
(
"X-Content-Type-Options"
)
refute
response_headers
.
key?
(
"X-XSS-Protection"
)
assert_not
response_headers
.
key?
(
"X-Frame-Options"
)
assert_not
response_headers
.
key?
(
"X-Content-Type-Options"
)
assert_not
response_headers
.
key?
(
"X-XSS-Protection"
)
ensure
ActionDispatch
::
Response
.
default_headers
=
original_default_headers
end
...
...
actionpack/test/controller/parameters/accessors_test.rb
浏览文件 @
211adb47
...
...
@@ -82,7 +82,7 @@ class ParametersAccessorsTest < ActiveSupport::TestCase
end
test
"empty? returns false when any params are present"
do
refute
@params
.
empty?
assert_not
@params
.
empty?
end
test
"except retains permitted status"
do
...
...
@@ -112,7 +112,7 @@ class ParametersAccessorsTest < ActiveSupport::TestCase
end
test
"has_key? returns false if the given key is not present in the params"
do
refute
@params
.
has_key?
(
:address
)
assert_not
@params
.
has_key?
(
:address
)
end
test
"has_value? returns true if the given value is present in the params"
do
...
...
@@ -122,7 +122,7 @@ class ParametersAccessorsTest < ActiveSupport::TestCase
test
"has_value? returns false if the given value is not present in the params"
do
params
=
ActionController
::
Parameters
.
new
(
city:
"Chicago"
,
state:
"Illinois"
)
refute
params
.
has_value?
(
"New York"
)
assert_not
params
.
has_value?
(
"New York"
)
end
test
"include? returns true if the given key is present in the params"
do
...
...
@@ -130,7 +130,7 @@ class ParametersAccessorsTest < ActiveSupport::TestCase
end
test
"include? returns false if the given key is not present in the params"
do
refute
@params
.
include?
(
:address
)
assert_not
@params
.
include?
(
:address
)
end
test
"key? returns true if the given key is present in the params"
do
...
...
@@ -138,7 +138,7 @@ class ParametersAccessorsTest < ActiveSupport::TestCase
end
test
"key? returns false if the given key is not present in the params"
do
refute
@params
.
key?
(
:address
)
assert_not
@params
.
key?
(
:address
)
end
test
"keys returns an array of the keys of the params"
do
...
...
@@ -198,7 +198,7 @@ class ParametersAccessorsTest < ActiveSupport::TestCase
test
"value? returns false if the given value is not present in the params"
do
params
=
ActionController
::
Parameters
.
new
(
city:
"Chicago"
,
state:
"Illinois"
)
refute
params
.
value?
(
"New York"
)
assert_not
params
.
value?
(
"New York"
)
end
test
"values returns an array of the values of the params"
do
...
...
actionpack/test/controller/parameters/parameters_permit_test.rb
浏览文件 @
211adb47
...
...
@@ -500,9 +500,9 @@ def dup; @dupped = true; end
params
=
ActionController
::
Parameters
.
new
(
foo:
"bar"
)
assert
params
.
permit
(
:foo
).
has_key?
(
:foo
)
refute
params
.
permit
(
foo:
[]).
has_key?
(
:foo
)
refute
params
.
permit
(
foo:
[
:bar
]).
has_key?
(
:foo
)
refute
params
.
permit
(
foo: :bar
).
has_key?
(
:foo
)
assert_not
params
.
permit
(
foo:
[]).
has_key?
(
:foo
)
assert_not
params
.
permit
(
foo:
[
:bar
]).
has_key?
(
:foo
)
assert_not
params
.
permit
(
foo: :bar
).
has_key?
(
:foo
)
end
test
"#permitted? is false by default"
do
...
...
activemodel/test/cases/attribute_test.rb
浏览文件 @
211adb47
...
...
@@ -187,7 +187,7 @@ def assert_valid_value(*)
test
"an attribute is not changed if it hasn't been assigned or mutated"
do
attribute
=
Attribute
.
from_database
(
:foo
,
1
,
Type
::
Value
.
new
)
refute
attribute
.
changed?
assert_not
attribute
.
changed?
end
test
"an attribute is changed if it's been assigned a new value"
do
...
...
@@ -201,7 +201,7 @@ def assert_valid_value(*)
attribute
=
Attribute
.
from_database
(
:foo
,
1
,
Type
::
Value
.
new
)
unchanged
=
attribute
.
with_value_from_user
(
1
)
refute
unchanged
.
changed?
assert_not
unchanged
.
changed?
end
test
"an attribute can not be mutated if it has not been read,
...
...
@@ -226,7 +226,7 @@ def assert_valid_value(*)
forgotten
=
changed
.
forgetting_assignment
assert
changed
.
changed?
# sanity check
refute
forgotten
.
changed?
assert_not
forgotten
.
changed?
end
test
"with_value_from_user validates the value"
do
...
...
activerecord/test/cases/adapters/postgresql/array_test.rb
浏览文件 @
211adb47
...
...
@@ -257,7 +257,7 @@ def test_string_quoting_rules_match_pg_behavior
x
=
PgArray
.
create!
(
tags:
tags
)
x
.
reload
refute
x
.
changed?
assert_not
x
.
changed?
end
def
test_quoting_non_standard_delimiters
...
...
activerecord/test/cases/adapters/postgresql/hstore_test.rb
浏览文件 @
211adb47
...
...
@@ -174,7 +174,7 @@ def test_dirty_from_user_equal
hstore
.
settings
=
{
"key"
=>
"value"
,
"alongkey"
=>
"anything"
}
assert_equal
settings
,
hstore
.
settings
refute
hstore
.
changed?
assert_not
hstore
.
changed?
end
def
test_hstore_dirty_from_database_equal
...
...
@@ -184,7 +184,7 @@ def test_hstore_dirty_from_database_equal
assert_equal
settings
,
hstore
.
settings
hstore
.
settings
=
settings
refute
hstore
.
changed?
assert_not
hstore
.
changed?
end
def
test_gen1
...
...
activerecord/test/cases/attributes_test.rb
浏览文件 @
211adb47
...
...
@@ -211,7 +211,7 @@ def deserialize(*)
end
test
"attributes not backed by database columns are not dirty when unchanged"
do
refute
OverloadedType
.
new
.
non_existent_decimal_changed?
assert_not
OverloadedType
.
new
.
non_existent_decimal_changed?
end
test
"attributes not backed by database columns are always initialized"
do
...
...
@@ -251,7 +251,7 @@ def deserialize(*)
assert_equal
"lol"
,
model
.
foo
model
.
foo
=
"lol"
refute
model
.
changed?
assert_not
model
.
changed?
end
test
"attributes not backed by database columns appear in inspect"
do
...
...
activerecord/test/cases/base_test.rb
浏览文件 @
211adb47
...
...
@@ -1490,7 +1490,7 @@ def test_default_values_are_deeply_dupped
query
=
Developer
.
all
.
to_sql
.
downcase
# ignored column
refute
query
.
include?
(
"first_name"
)
assert_not
query
.
include?
(
"first_name"
)
# regular column
assert
query
.
include?
(
"name"
)
...
...
activerecord/test/cases/dirty_test.rb
浏览文件 @
211adb47
...
...
@@ -762,7 +762,7 @@ def catchphrase
test
"attributes assigned but not selected are dirty"
do
person
=
Person
.
select
(
:id
).
first
refute
person
.
changed?
assert_not
person
.
changed?
person
.
first_name
=
"Sean"
assert
person
.
changed?
...
...
@@ -782,13 +782,13 @@ def catchphrase
person
=
Person
.
create!
(
first_name:
"Sean"
)
assert
person
.
saved_change_to_first_name?
refute
person
.
saved_change_to_gender?
assert_not
person
.
saved_change_to_gender?
assert
person
.
saved_change_to_first_name?
(
from:
nil
,
to:
"Sean"
)
assert
person
.
saved_change_to_first_name?
(
from:
nil
)
assert
person
.
saved_change_to_first_name?
(
to:
"Sean"
)
refute
person
.
saved_change_to_first_name?
(
from:
"Jim"
,
to:
"Sean"
)
refute
person
.
saved_change_to_first_name?
(
from:
"Jim"
)
refute
person
.
saved_change_to_first_name?
(
to:
"Jim"
)
assert_not
person
.
saved_change_to_first_name?
(
from:
"Jim"
,
to:
"Sean"
)
assert_not
person
.
saved_change_to_first_name?
(
from:
"Jim"
)
assert_not
person
.
saved_change_to_first_name?
(
to:
"Jim"
)
end
test
"saved_change_to_attribute returns the change that occurred in the last save"
do
...
...
@@ -827,7 +827,7 @@ def catchphrase
person
.
save
refute
person
.
saved_changes?
assert_not
person
.
saved_changes?
end
test
"saved_changes returns a hash of all the changes that occurred"
do
...
...
@@ -857,7 +857,7 @@ def catchphrase
end
person
=
klass
.
create!
(
first_name:
"Sean"
)
refute
person
.
changed?
assert_not
person
.
changed?
end
private
...
...
activerecord/test/cases/locking_test.rb
浏览文件 @
211adb47
...
...
@@ -532,7 +532,7 @@ def test_destroy_stale_object
stale_object
.
destroy!
end
refute
stale_object
.
destroyed?
assert_not
stale_object
.
destroyed?
end
private
...
...
activerecord/test/cases/migration/foreign_key_test.rb
浏览文件 @
211adb47
...
...
@@ -235,12 +235,12 @@ def test_add_invalid_foreign_key
assert_equal
1
,
foreign_keys
.
size
fk
=
foreign_keys
.
first
refute
fk
.
validated?
assert_not
fk
.
validated?
end
def
test_validate_foreign_key_infers_column
@connection
.
add_foreign_key
:astronauts
,
:rockets
,
validate:
false
refute
@connection
.
foreign_keys
(
"astronauts"
).
first
.
validated?
assert_not
@connection
.
foreign_keys
(
"astronauts"
).
first
.
validated?
@connection
.
validate_foreign_key
:astronauts
,
:rockets
assert
@connection
.
foreign_keys
(
"astronauts"
).
first
.
validated?
...
...
@@ -248,7 +248,7 @@ def test_validate_foreign_key_infers_column
def
test_validate_foreign_key_by_column
@connection
.
add_foreign_key
:astronauts
,
:rockets
,
column:
"rocket_id"
,
validate:
false
refute
@connection
.
foreign_keys
(
"astronauts"
).
first
.
validated?
assert_not
@connection
.
foreign_keys
(
"astronauts"
).
first
.
validated?
@connection
.
validate_foreign_key
:astronauts
,
column:
"rocket_id"
assert
@connection
.
foreign_keys
(
"astronauts"
).
first
.
validated?
...
...
@@ -256,7 +256,7 @@ def test_validate_foreign_key_by_column
def
test_validate_foreign_key_by_symbol_column
@connection
.
add_foreign_key
:astronauts
,
:rockets
,
column: :rocket_id
,
validate:
false
refute
@connection
.
foreign_keys
(
"astronauts"
).
first
.
validated?
assert_not
@connection
.
foreign_keys
(
"astronauts"
).
first
.
validated?
@connection
.
validate_foreign_key
:astronauts
,
column: :rocket_id
assert
@connection
.
foreign_keys
(
"astronauts"
).
first
.
validated?
...
...
@@ -264,7 +264,7 @@ def test_validate_foreign_key_by_symbol_column
def
test_validate_foreign_key_by_name
@connection
.
add_foreign_key
:astronauts
,
:rockets
,
column:
"rocket_id"
,
name:
"fancy_named_fk"
,
validate:
false
refute
@connection
.
foreign_keys
(
"astronauts"
).
first
.
validated?
assert_not
@connection
.
foreign_keys
(
"astronauts"
).
first
.
validated?
@connection
.
validate_foreign_key
:astronauts
,
name:
"fancy_named_fk"
assert
@connection
.
foreign_keys
(
"astronauts"
).
first
.
validated?
...
...
activerecord/test/cases/migration/rename_table_test.rb
浏览文件 @
211adb47
...
...
@@ -86,7 +86,7 @@ def test_renaming_table_renames_primary_key
rename_table
:cats
,
:felines
assert
connection
.
table_exists?
:felines
refute
connection
.
table_exists?
:cats
assert_not
connection
.
table_exists?
:cats
primary_key_name
=
connection
.
select_values
(
<<-
SQL
.
strip_heredoc
,
"SCHEMA"
)[
0
]
SELECT c.relname
...
...
@@ -107,7 +107,7 @@ def test_renaming_table_doesnt_attempt_to_rename_non_existent_sequences
connection
.
create_table
:cats
,
id: :uuid
,
default:
"uuid_generate_v4()"
assert_nothing_raised
{
rename_table
:cats
,
:felines
}
assert
connection
.
table_exists?
:felines
refute
connection
.
table_exists?
:cats
assert_not
connection
.
table_exists?
:cats
ensure
connection
.
drop_table
:cats
,
if_exists:
true
connection
.
drop_table
:felines
,
if_exists:
true
...
...
activerecord/test/cases/query_cache_test.rb
浏览文件 @
211adb47
...
...
@@ -327,7 +327,7 @@ def test_cache_is_available_when_using_a_not_connected_connection
conf
=
ActiveRecord
::
Base
.
configurations
[
"arunit"
].
merge
(
"name"
=>
"test2"
)
ActiveRecord
::
Base
.
connection_handler
.
establish_connection
(
conf
)
Task
.
connection_specification_name
=
"test2"
refute
Task
.
connected?
assert_not
Task
.
connected?
Task
.
cache
do
begin
...
...
@@ -414,20 +414,20 @@ def test_query_cached_even_when_types_are_reset
def
test_query_cache_does_not_establish_connection_if_unconnected
with_temporary_connection_pool
do
ActiveRecord
::
Base
.
clear_active_connections!
refute
ActiveRecord
::
Base
.
connection_handler
.
active_connections?
# sanity check
assert_not
ActiveRecord
::
Base
.
connection_handler
.
active_connections?
# sanity check
middleware
{
refute
ActiveRecord
::
Base
.
connection_handler
.
active_connections?
,
"QueryCache forced ActiveRecord::Base to establish a connection in setup"
assert_not
ActiveRecord
::
Base
.
connection_handler
.
active_connections?
,
"QueryCache forced ActiveRecord::Base to establish a connection in setup"
}.
call
({})
refute
ActiveRecord
::
Base
.
connection_handler
.
active_connections?
,
"QueryCache forced ActiveRecord::Base to establish a connection in cleanup"
assert_not
ActiveRecord
::
Base
.
connection_handler
.
active_connections?
,
"QueryCache forced ActiveRecord::Base to establish a connection in cleanup"
end
end
def
test_query_cache_is_enabled_on_connections_established_after_middleware_runs
with_temporary_connection_pool
do
ActiveRecord
::
Base
.
clear_active_connections!
refute
ActiveRecord
::
Base
.
connection_handler
.
active_connections?
# sanity check
assert_not
ActiveRecord
::
Base
.
connection_handler
.
active_connections?
# sanity check
middleware
{
assert
ActiveRecord
::
Base
.
connection
.
query_cache_enabled
,
"QueryCache did not get lazily enabled"
...
...
@@ -444,8 +444,8 @@ def test_query_caching_is_local_to_the_current_thread
assert
ActiveRecord
::
Base
.
connection
.
query_cache_enabled
Thread
.
new
{
refute
ActiveRecord
::
Base
.
connection_pool
.
query_cache_enabled
refute
ActiveRecord
::
Base
.
connection
.
query_cache_enabled
assert_not
ActiveRecord
::
Base
.
connection_pool
.
query_cache_enabled
assert_not
ActiveRecord
::
Base
.
connection
.
query_cache_enabled
}.
join
}.
call
({})
...
...
activerecord/test/cases/relation/merging_test.rb
浏览文件 @
211adb47
...
...
@@ -115,7 +115,7 @@ def test_merging_with_from_clause
relation
=
Post
.
all
assert
relation
.
from_clause
.
empty?
relation
=
relation
.
merge
(
Post
.
from
(
"posts"
))
refute
relation
.
from_clause
.
empty?
assert_not
relation
.
from_clause
.
empty?
end
end
...
...
activerecord/test/cases/serialized_attribute_test.rb
浏览文件 @
211adb47
...
...
@@ -349,7 +349,7 @@ def deserialize(value)
topic
=
model
.
create!
(
foo:
"bar"
)
topic
.
foo
refute
topic
.
changed?
assert_not
topic
.
changed?
end
def
test_serialized_attribute_works_under_concurrent_initial_access
...
...
activerecord/test/cases/validations/uniqueness_validation_test.rb
浏览文件 @
211adb47
...
...
@@ -530,7 +530,7 @@ def test_validate_uniqueness_with_after_create_performing_save
assert
topic
.
author_name
.
start_with?
(
"Title1"
)
topic2
=
TopicWithAfterCreate
.
new
(
title:
"Title1"
)
refute
topic2
.
valid?
assert_not
topic2
.
valid?
assert_equal
([
"has already been taken"
],
topic2
.
errors
[
:title
])
end
...
...
@@ -550,7 +550,7 @@ def test_validate_uniqueness_regular_id
assert_empty
item
.
errors
item2
=
CoolTopic
.
new
(
id:
item
.
id
,
title:
"MyItem2"
)
refute
item2
.
valid?
assert_not
item2
.
valid?
assert_equal
([
"has already been taken"
],
item2
.
errors
[
:id
])
end
...
...
activesupport/test/core_ext/class_test.rb
浏览文件 @
211adb47
...
...
@@ -30,11 +30,11 @@ def test_subclasses
def
test_descendants_excludes_singleton_classes
klass
=
Parent
.
new
.
singleton_class
refute
Parent
.
descendants
.
include?
(
klass
),
"descendants should not include singleton classes"
assert_not
Parent
.
descendants
.
include?
(
klass
),
"descendants should not include singleton classes"
end
def
test_subclasses_excludes_singleton_classes
klass
=
Parent
.
new
.
singleton_class
refute
Parent
.
subclasses
.
include?
(
klass
),
"subclasses should not include singleton classes"
assert_not
Parent
.
subclasses
.
include?
(
klass
),
"subclasses should not include singleton classes"
end
end
railties/test/application/configuration_test.rb
浏览文件 @
211adb47
...
...
@@ -1831,7 +1831,7 @@ class Post < ActiveRecord::Base
test
"api_only is false by default"
do
app
"development"
refute
Rails
.
application
.
config
.
api_only
assert_not
Rails
.
application
.
config
.
api_only
end
test
"api_only generator config is set when api_only is set"
do
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录