Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
7b31b06d
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,发现更多精彩内容 >>
提交
7b31b06d
编写于
8月 09, 2016
作者:
X
Xavier Noria
提交者:
GitHub
8月 09, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #26095 from kamipo/fix_broken_alignment_by_auto_correct
Fix broken alignments caused by auto-correct commit
411ccbda
上级
67d0c9ee
f006de5d
变更
20
隐藏空白更改
内联
并排
Showing
20 changed file
with
77 addition
and
39 deletion
+77
-39
actionpack/test/abstract/translation_test.rb
actionpack/test/abstract/translation_test.rb
+2
-1
actionpack/test/controller/new_base/render_action_test.rb
actionpack/test/controller/new_base/render_action_test.rb
+2
-1
actionpack/test/controller/parameters/always_permitted_parameters_test.rb
...controller/parameters/always_permitted_parameters_test.rb
+2
-1
actionpack/test/controller/parameters/log_on_unpermitted_params_test.rb
...t/controller/parameters/log_on_unpermitted_params_test.rb
+8
-4
actionpack/test/controller/parameters/multi_parameter_attributes_test.rb
.../controller/parameters/multi_parameter_attributes_test.rb
+2
-1
actionpack/test/controller/parameters/nested_parameters_permit_test.rb
...st/controller/parameters/nested_parameters_permit_test.rb
+20
-10
actionpack/test/controller/parameters/raise_on_unpermitted_params_test.rb
...controller/parameters/raise_on_unpermitted_params_test.rb
+4
-2
actionpack/test/controller/routing_test.rb
actionpack/test/controller/routing_test.rb
+6
-3
actionpack/test/journey/route_test.rb
actionpack/test/journey/route_test.rb
+4
-2
actionview/test/actionpack/controller/view_paths_test.rb
actionview/test/actionpack/controller/view_paths_test.rb
+1
-1
actionview/test/template/form_helper_test.rb
actionview/test/template/form_helper_test.rb
+6
-3
activemodel/lib/active_model/errors.rb
activemodel/lib/active_model/errors.rb
+2
-1
activemodel/test/cases/validations/confirmation_validation_test.rb
...el/test/cases/validations/confirmation_validation_test.rb
+2
-1
activerecord/lib/active_record/connection_adapters/connection_specification.rb
...ve_record/connection_adapters/connection_specification.rb
+4
-2
activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb
...associations/has_and_belongs_to_many_associations_test.rb
+2
-1
activerecord/test/cases/base_test.rb
activerecord/test/cases/base_test.rb
+2
-1
activerecord/test/cases/nested_attributes_test.rb
activerecord/test/cases/nested_attributes_test.rb
+2
-1
activerecord/test/cases/persistence_test.rb
activerecord/test/cases/persistence_test.rb
+2
-1
guides/rails_guides/markdown.rb
guides/rails_guides/markdown.rb
+2
-1
railties/lib/rails/commands/server.rb
railties/lib/rails/commands/server.rb
+2
-1
未找到文件。
actionpack/test/abstract/translation_test.rb
浏览文件 @
7b31b06d
...
...
@@ -9,7 +9,8 @@ class TranslationController < AbstractController::Base
class
TranslationControllerTest
<
ActiveSupport
::
TestCase
def
setup
@controller
=
TranslationController
.
new
I18n
.
backend
.
store_translations
(
:en
,
one:
{
I18n
.
backend
.
store_translations
(
:en
,
one:
{
two:
"bar"
,
},
abstract_controller:
{
...
...
actionpack/test/controller/new_base/render_action_test.rb
浏览文件 @
7b31b06d
...
...
@@ -258,7 +258,8 @@ class ControllerLayoutTest < Rack::TestCase
module
RenderActionWithBothLayouts
class
BasicController
<
ActionController
::
Base
self
.
view_paths
=
[
ActionView
::
FixtureResolver
.
new
(
"render_action_with_both_layouts/basic/hello_world.html.erb"
=>
"Hello World!"
,
self
.
view_paths
=
[
ActionView
::
FixtureResolver
.
new
(
"render_action_with_both_layouts/basic/hello_world.html.erb"
=>
"Hello World!"
,
"layouts/application.html.erb"
=>
"Oh Hi <%= yield %> Bye"
,
"layouts/render_action_with_both_layouts/basic.html.erb"
=>
"With Controller Layout! <%= yield %> Bye"
)]
...
...
actionpack/test/controller/parameters/always_permitted_parameters_test.rb
浏览文件 @
7b31b06d
...
...
@@ -19,7 +19,8 @@ def teardown
end
test
"permits parameters that are whitelisted"
do
params
=
ActionController
::
Parameters
.
new
(
book:
{
pages:
65
},
params
=
ActionController
::
Parameters
.
new
(
book:
{
pages:
65
},
format:
"json"
)
permitted
=
params
.
permit
book:
[
:pages
]
assert
permitted
.
permitted?
...
...
actionpack/test/controller/parameters/log_on_unpermitted_params_test.rb
浏览文件 @
7b31b06d
...
...
@@ -11,7 +11,8 @@ def teardown
end
test
"logs on unexpected param"
do
params
=
ActionController
::
Parameters
.
new
(
book:
{
pages:
65
},
params
=
ActionController
::
Parameters
.
new
(
book:
{
pages:
65
},
fishing:
"Turnips"
)
assert_logged
(
"Unpermitted parameter: fishing"
)
do
...
...
@@ -20,7 +21,8 @@ def teardown
end
test
"logs on unexpected params"
do
params
=
ActionController
::
Parameters
.
new
(
book:
{
pages:
65
},
params
=
ActionController
::
Parameters
.
new
(
book:
{
pages:
65
},
fishing:
"Turnips"
,
car:
"Mersedes"
)
...
...
@@ -30,7 +32,8 @@ def teardown
end
test
"logs on unexpected nested param"
do
params
=
ActionController
::
Parameters
.
new
(
book:
{
pages:
65
,
title:
"Green Cats and where to find then."
})
params
=
ActionController
::
Parameters
.
new
(
book:
{
pages:
65
,
title:
"Green Cats and where to find then."
})
assert_logged
(
"Unpermitted parameter: title"
)
do
params
.
permit
(
book:
[
:pages
])
...
...
@@ -38,7 +41,8 @@ def teardown
end
test
"logs on unexpected nested params"
do
params
=
ActionController
::
Parameters
.
new
(
book:
{
pages:
65
,
title:
"Green Cats and where to find then."
,
author:
"G. A. Dog"
})
params
=
ActionController
::
Parameters
.
new
(
book:
{
pages:
65
,
title:
"Green Cats and where to find then."
,
author:
"G. A. Dog"
})
assert_logged
(
"Unpermitted parameters: title, author"
)
do
params
.
permit
(
book:
[
:pages
])
...
...
actionpack/test/controller/parameters/multi_parameter_attributes_test.rb
浏览文件 @
7b31b06d
...
...
@@ -3,7 +3,8 @@
class
MultiParameterAttributesTest
<
ActiveSupport
::
TestCase
test
"permitted multi-parameter attribute keys"
do
params
=
ActionController
::
Parameters
.
new
(
book:
{
params
=
ActionController
::
Parameters
.
new
(
book:
{
"shipped_at(1i)"
=>
"2012"
,
"shipped_at(2i)"
=>
"3"
,
"shipped_at(3i)"
=>
"25"
,
...
...
actionpack/test/controller/parameters/nested_parameters_permit_test.rb
浏览文件 @
7b31b06d
...
...
@@ -7,7 +7,8 @@ def assert_filtered_out(params, key)
end
test
"permitted nested parameters"
do
params
=
ActionController
::
Parameters
.
new
(
book:
{
params
=
ActionController
::
Parameters
.
new
(
book:
{
title:
"Romeo and Juliet"
,
authors:
[{
name:
"William Shakespeare"
,
...
...
@@ -43,7 +44,8 @@ def assert_filtered_out(params, key)
end
test
"permitted nested parameters with a string or a symbol as a key"
do
params
=
ActionController
::
Parameters
.
new
(
book:
{
params
=
ActionController
::
Parameters
.
new
(
book:
{
"authors"
=>
[
{
name:
"William Shakespeare"
,
born:
"1564-04-26"
},
{
name:
"Christopher Marlowe"
}
...
...
@@ -66,7 +68,8 @@ def assert_filtered_out(params, key)
end
test
"nested arrays with strings"
do
params
=
ActionController
::
Parameters
.
new
(
book:
{
params
=
ActionController
::
Parameters
.
new
(
book:
{
genres:
[
"Tragedy"
]
})
...
...
@@ -75,7 +78,8 @@ def assert_filtered_out(params, key)
end
test
"permit may specify symbols or strings"
do
params
=
ActionController
::
Parameters
.
new
(
book:
{
params
=
ActionController
::
Parameters
.
new
(
book:
{
title:
"Romeo and Juliet"
,
author:
"William Shakespeare"
},
...
...
@@ -88,7 +92,8 @@ def assert_filtered_out(params, key)
end
test
"nested array with strings that should be hashes"
do
params
=
ActionController
::
Parameters
.
new
(
book:
{
params
=
ActionController
::
Parameters
.
new
(
book:
{
genres:
[
"Tragedy"
]
})
...
...
@@ -97,7 +102,8 @@ def assert_filtered_out(params, key)
end
test
"nested array with strings that should be hashes and additional values"
do
params
=
ActionController
::
Parameters
.
new
(
book:
{
params
=
ActionController
::
Parameters
.
new
(
book:
{
title:
"Romeo and Juliet"
,
genres:
[
"Tragedy"
]
})
...
...
@@ -108,7 +114,8 @@ def assert_filtered_out(params, key)
end
test
"nested string that should be a hash"
do
params
=
ActionController
::
Parameters
.
new
(
book:
{
params
=
ActionController
::
Parameters
.
new
(
book:
{
genre:
"Tragedy"
})
...
...
@@ -117,7 +124,8 @@ def assert_filtered_out(params, key)
end
test
"fields_for-style nested params"
do
params
=
ActionController
::
Parameters
.
new
(
book:
{
params
=
ActionController
::
Parameters
.
new
(
book:
{
authors_attributes:
{
'0'
:
{
name:
"William Shakespeare"
,
age_of_death:
"52"
},
'1'
:
{
name:
"Unattributed Assistant"
},
...
...
@@ -136,7 +144,8 @@ def assert_filtered_out(params, key)
end
test
"fields_for-style nested params with negative numbers"
do
params
=
ActionController
::
Parameters
.
new
(
book:
{
params
=
ActionController
::
Parameters
.
new
(
book:
{
authors_attributes:
{
'-1'
:
{
name:
"William Shakespeare"
,
age_of_death:
"52"
},
'-2'
:
{
name:
"Unattributed Assistant"
}
...
...
@@ -153,7 +162,8 @@ def assert_filtered_out(params, key)
end
test
"nested number as key"
do
params
=
ActionController
::
Parameters
.
new
(
product:
{
params
=
ActionController
::
Parameters
.
new
(
product:
{
properties:
{
"0"
=>
"prop0"
,
"1"
=>
"prop1"
...
...
actionpack/test/controller/parameters/raise_on_unpermitted_params_test.rb
浏览文件 @
7b31b06d
...
...
@@ -11,7 +11,8 @@ def teardown
end
test
"raises on unexpected params"
do
params
=
ActionController
::
Parameters
.
new
(
book:
{
pages:
65
},
params
=
ActionController
::
Parameters
.
new
(
book:
{
pages:
65
},
fishing:
"Turnips"
)
assert_raises
(
ActionController
::
UnpermittedParameters
)
do
...
...
@@ -20,7 +21,8 @@ def teardown
end
test
"raises on unexpected nested params"
do
params
=
ActionController
::
Parameters
.
new
(
book:
{
pages:
65
,
title:
"Green Cats and where to find then."
})
params
=
ActionController
::
Parameters
.
new
(
book:
{
pages:
65
,
title:
"Green Cats and where to find then."
})
assert_raises
(
ActionController
::
UnpermittedParameters
)
do
params
.
permit
(
book:
[
:pages
])
...
...
actionpack/test/controller/routing_test.rb
浏览文件 @
7b31b06d
...
...
@@ -29,7 +29,8 @@ def setup
def
test_route_generation_escapes_unsafe_path_characters
assert_equal
"/content/act
#{
@escaped
}
ion/var
#{
@escaped
}
iable/add
#{
@escaped
}
itional-1/add
#{
@escaped
}
itional-2"
,
url_for
(
@set
,
controller:
"content"
,
url_for
(
@set
,
controller:
"content"
,
action:
"act
#{
@segment
}
ion"
,
variable:
"var
#{
@segment
}
iable"
,
additional:
[
"add
#{
@segment
}
itional-1"
,
"add
#{
@segment
}
itional-2"
])
...
...
@@ -45,7 +46,8 @@ def test_route_recognition_unescapes_path_components
def
test_route_generation_allows_passing_non_string_values_to_generated_helper
assert_equal
"/content/action/variable/1/2"
,
url_for
(
@set
,
controller:
"content"
,
url_for
(
@set
,
controller:
"content"
,
action:
"action"
,
variable:
"variable"
,
additional:
[
1
,
2
])
...
...
@@ -776,7 +778,8 @@ def test_nil_defaults
end
end
assert_equal
"/journal"
,
url_for
(
rs
,
controller:
"content"
,
assert_equal
"/journal"
,
url_for
(
rs
,
controller:
"content"
,
action:
"list_journal"
,
date:
nil
,
user_id:
nil
)
...
...
actionpack/test/journey/route_test.rb
浏览文件 @
7b31b06d
...
...
@@ -50,7 +50,8 @@ def test_format_with_star
path
=
Path
::
Pattern
.
from_string
"/:controller/*extra"
route
=
Route
.
build
(
"name"
,
nil
,
path
,
{},
[],
controller:
"foo"
,
action:
"bar"
)
assert_equal
"/foo/himom"
,
route
.
format
(
controller:
"foo"
,
assert_equal
"/foo/himom"
,
route
.
format
(
controller:
"foo"
,
extra:
"himom"
)
end
...
...
@@ -58,7 +59,8 @@ def test_connects_all_match
path
=
Path
::
Pattern
.
from_string
"/:controller(/:action(/:id(.:format)))"
route
=
Route
.
build
(
"name"
,
nil
,
path
,
{
action:
"bar"
},
[],
controller:
"foo"
)
assert_equal
"/foo/bar/10"
,
route
.
format
(
controller:
"foo"
,
assert_equal
"/foo/bar/10"
,
route
.
format
(
controller:
"foo"
,
action:
"bar"
,
id:
10
)
end
...
...
actionview/test/actionpack/controller/view_paths_test.rb
浏览文件 @
7b31b06d
...
...
@@ -131,7 +131,7 @@ def find_all(*args)
"Decorated body"
,
template
.
identifier
,
template
.
handler
,
virtual_path:
template
.
virtual_path
,
virtual_path:
template
.
virtual_path
,
format:
template
.
formats
)
end
...
...
actionview/test/template/form_helper_test.rb
浏览文件 @
7b31b06d
...
...
@@ -16,7 +16,8 @@ def form_for(*)
setup
do
# Create "label" locale for testing I18n label helpers
I18n
.
backend
.
store_translations
"label"
,
activemodel:
{
I18n
.
backend
.
store_translations
"label"
,
activemodel:
{
attributes:
{
post:
{
cost:
"Total cost"
...
...
@@ -47,7 +48,8 @@ def form_for(*)
}
# Create "submit" locale for testing I18n submit helpers
I18n
.
backend
.
store_translations
"submit"
,
helpers:
{
I18n
.
backend
.
store_translations
"submit"
,
helpers:
{
submit:
{
create:
"Create %{model}"
,
update:
"Confirm %{model} changes"
,
...
...
@@ -58,7 +60,8 @@ def form_for(*)
}
}
I18n
.
backend
.
store_translations
"placeholder"
,
activemodel:
{
I18n
.
backend
.
store_translations
"placeholder"
,
activemodel:
{
attributes:
{
post:
{
cost:
"Total cost"
...
...
activemodel/lib/active_model/errors.rb
浏览文件 @
7b31b06d
...
...
@@ -439,7 +439,8 @@ def full_message(attribute, message)
return
message
if
attribute
==
:base
attr_name
=
attribute
.
to_s
.
tr
(
"."
,
"_"
).
humanize
attr_name
=
@base
.
class
.
human_attribute_name
(
attribute
,
default:
attr_name
)
I18n
.
t
(
:"errors.format"
,
default:
"%{attribute} %{message}"
,
I18n
.
t
(
:"errors.format"
,
default:
"%{attribute} %{message}"
,
attribute:
attr_name
,
message:
message
)
end
...
...
activemodel/test/cases/validations/confirmation_validation_test.rb
浏览文件 @
7b31b06d
...
...
@@ -55,7 +55,8 @@ def test_title_confirmation_with_i18n_attribute
@old_load_path
,
@old_backend
=
I18n
.
load_path
.
dup
,
I18n
.
backend
I18n
.
load_path
.
clear
I18n
.
backend
=
I18n
::
Backend
::
Simple
.
new
I18n
.
backend
.
store_translations
(
"en"
,
errors:
{
messages:
{
confirmation:
"doesn't match %{attribute}"
}
},
I18n
.
backend
.
store_translations
(
"en"
,
errors:
{
messages:
{
confirmation:
"doesn't match %{attribute}"
}
},
activemodel:
{
attributes:
{
topic:
{
title:
"Test Title"
}
}
})
Topic
.
validates_confirmation_of
(
:title
)
...
...
activerecord/lib/active_record/connection_adapters/connection_specification.rb
浏览文件 @
7b31b06d
...
...
@@ -78,10 +78,12 @@ def query_hash
def
raw_config
if
uri
.
opaque
query_hash
.
merge
(
"adapter"
=>
@adapter
,
query_hash
.
merge
(
"adapter"
=>
@adapter
,
"database"
=>
uri
.
opaque
)
else
query_hash
.
merge
(
"adapter"
=>
@adapter
,
query_hash
.
merge
(
"adapter"
=>
@adapter
,
"username"
=>
uri
.
user
,
"password"
=>
uri
.
password
,
"port"
=>
uri
.
port
,
...
...
activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb
浏览文件 @
7b31b06d
...
...
@@ -283,7 +283,8 @@ def test_habtm_collection_size_from_build
end
def
test_habtm_collection_size_from_params
devel
=
Developer
.
new
(
projects_attributes:
{
devel
=
Developer
.
new
(
projects_attributes:
{
"0"
=>
{}
})
...
...
activerecord/test/cases/base_test.rb
浏览文件 @
7b31b06d
...
...
@@ -279,7 +279,8 @@ def test_custom_mutator
end
def
test_initialize_with_attributes
topic
=
Topic
.
new
(
"title"
=>
"initialized from attributes"
,
"written_on"
=>
"2003-12-12 23:23"
)
topic
=
Topic
.
new
(
"title"
=>
"initialized from attributes"
,
"written_on"
=>
"2003-12-12 23:23"
)
assert_equal
(
"initialized from attributes"
,
topic
.
title
)
end
...
...
activerecord/test/cases/nested_attributes_test.rb
浏览文件 @
7b31b06d
...
...
@@ -596,7 +596,8 @@ def test_should_raise_an_UnknownAttributeError_for_non_existing_nested_attribute
end
def
test_should_save_only_one_association_on_create
pirate
=
Pirate
.
create!
(
:catchphrase
=>
"Arr"
,
pirate
=
Pirate
.
create!
(
:catchphrase
=>
"Arr"
,
association_getter
=>
{
"foo"
=>
{
name:
"Grace OMalley"
}
})
assert_equal
1
,
pirate
.
reload
.
send
(
@association_name
).
count
...
...
activerecord/test/cases/persistence_test.rb
浏览文件 @
7b31b06d
...
...
@@ -967,7 +967,8 @@ def test_save_touch_false
self
.
table_name
=
:widgets
end
instance
=
widget
.
create!
(
name:
"Bob"
,
instance
=
widget
.
create!
(
name:
"Bob"
,
created_at:
1
.
day
.
ago
,
updated_at:
1
.
day
.
ago
)
...
...
guides/rails_guides/markdown.rb
浏览文件 @
7b31b06d
...
...
@@ -54,7 +54,8 @@ def dom_id_text(text)
end
def
engine
@engine
||=
Redcarpet
::
Markdown
.
new
(
Renderer
,
no_intra_emphasis:
true
,
@engine
||=
Redcarpet
::
Markdown
.
new
(
Renderer
,
no_intra_emphasis:
true
,
fenced_code_blocks:
true
,
autolink:
true
,
strikethrough:
true
,
...
...
railties/lib/rails/commands/server.rb
浏览文件 @
7b31b06d
...
...
@@ -88,7 +88,8 @@ def middleware
end
def
default_options
super
.
merge
(
Port
:
ENV
.
fetch
(
"PORT"
,
3000
).
to_i
,
super
.
merge
(
Port
:
ENV
.
fetch
(
"PORT"
,
3000
).
to_i
,
Host
:
ENV
.
fetch
(
"HOST"
,
"localhost"
).
dup
,
DoNotReverseLookup
:
true
,
environment:
(
ENV
[
"RAILS_ENV"
]
||
ENV
[
"RACK_ENV"
]
||
"development"
).
dup
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录