提交 7b31b06d 编写于 作者: X Xavier Noria 提交者: GitHub

Merge pull request #26095 from kamipo/fix_broken_alignment_by_auto_correct

Fix broken alignments caused by auto-correct commit 411ccbda
......@@ -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: {
......
......@@ -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")]
......
......@@ -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?
......
......@@ -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])
......
......@@ -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",
......
......@@ -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"
......
......@@ -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])
......
......@@ -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)
......
......@@ -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
......
......@@ -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
......
......@@ -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"
......
......@@ -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
......
......@@ -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)
......
......@@ -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,
......
......@@ -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" => {}
})
......
......@@ -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
......
......@@ -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
......
......@@ -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)
......
......@@ -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,
......
......@@ -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.
先完成此消息的编辑!
想要评论请 注册