提交 b70fc698 编写于 作者: A Akira Matsuda

Reduce string objects by using \ instead of + or << for concatenating strings

(I personally prefer writing one string in one line no matter how long it is, though)
上级 d688814a
......@@ -90,8 +90,8 @@ def close(code = nil, reason = nil)
reason ||= ""
unless code == 1000 || (code >= 3000 && code <= 4999)
raise ArgumentError, "Failed to execute 'close' on WebSocket: " +
"The code must be either 1000, or between 3000 and 4999. " +
raise ArgumentError, "Failed to execute 'close' on WebSocket: " \
"The code must be either 1000, or between 3000 and 4999. " \
"#{code} is neither."
end
......
......@@ -4,8 +4,8 @@
module ActionMailer
class NonInferrableMailerError < ::StandardError
def initialize(name)
super "Unable to determine the mailer to test from #{name}. " +
"You'll need to specify it using tests YourMailer in your " +
super "Unable to determine the mailer to test from #{name}. " \
"You'll need to specify it using tests YourMailer in your " \
"test case definition"
end
end
......
......@@ -2,11 +2,11 @@
class HelperMailer < ActionMailer::Base
def use_mail_helper
@text = "But soft! What light through yonder window breaks? It is the east, " +
"and Juliet is the sun. Arise, fair sun, and kill the envious moon, " +
"which is sick and pale with grief that thou, her maid, art far more " +
"fair than she. Be not her maid, for she is envious! Her vestal " +
"livery is but sick and green, and none but fools do wear it. Cast " +
@text = "But soft! What light through yonder window breaks? It is the east, " \
"and Juliet is the sun. Arise, fair sun, and kill the envious moon, " \
"which is sick and pale with grief that thou, her maid, art far more " \
"fair than she. Be not her maid, for she is envious! Her vestal " \
"livery is but sick and green, and none but fools do wear it. Cast " \
"it off!"
mail_with_defaults do |format|
......
......@@ -572,7 +572,7 @@ def initialize(parent_jar)
super
if ActiveSupport::LegacyKeyGenerator === key_generator
raise "You didn't set secrets.secret_key_base, which is required for this cookie jar. " +
raise "You didn't set secrets.secret_key_base, which is required for this cookie jar. " \
"Read the upgrade documentation to learn more about this new config option."
end
......
......@@ -131,8 +131,8 @@ def calculate_ip
should_check_ip = @check_ip && client_ips.last && forwarded_ips.last
if should_check_ip && !forwarded_ips.include?(client_ips.last)
# We don't know which came from the proxy, and which from the user
raise IpSpoofAttackError, "IP spoofing attack?! " +
"HTTP_CLIENT_IP=#{@req.client_ip.inspect} " +
raise IpSpoofAttackError, "IP spoofing attack?! " \
"HTTP_CLIENT_IP=#{@req.client_ip.inspect} " \
"HTTP_X_FORWARDED_FOR=#{@req.x_forwarded_for.inspect}"
end
......
......@@ -8,8 +8,8 @@ module ActionDispatch
module Session
class SessionRestoreError < StandardError #:nodoc:
def initialize
super("Session contains objects whose class definition isn't available.\n" +
"Remember to require the classes for all objects kept in the session.\n" +
super("Session contains objects whose class definition isn't available.\n" \
"Remember to require the classes for all objects kept in the session.\n" \
"(Original exception: #{$!.message} [#{$!.class}])\n")
set_backtrace $!.backtrace
end
......
......@@ -145,8 +145,8 @@ def reset!
self.host = DEFAULT_HOST
self.remote_addr = "127.0.0.1"
self.accept = "text/xml,application/xml,application/xhtml+xml," +
"text/html;q=0.9,text/plain;q=0.8,image/png," +
self.accept = "text/xml,application/xml,application/xhtml+xml," \
"text/html;q=0.9,text/plain;q=0.8,image/png," \
"*/*;q=0.5"
unless defined? @named_routes_configured
......
......@@ -704,7 +704,7 @@ def test_having_properties_in_around_action
def test_prepending_and_appending_around_action
test_process(MixedFilterController)
assert_equal " before aroundfilter before procfilter before appended aroundfilter " +
assert_equal " before aroundfilter before procfilter before appended aroundfilter " \
" after appended aroundfilter after procfilter after aroundfilter ",
MixedFilterController.execution_log
end
......
......@@ -175,7 +175,7 @@ def test_doesnt_write_session_cookie_if_session_is_not_accessed
def test_doesnt_write_session_cookie_if_session_is_unchanged
with_test_route_set do
cookies[SessionKey] = "BAh7BjoIZm9vIghiYXI%3D--" +
cookies[SessionKey] = "BAh7BjoIZm9vIghiYXI%3D--" \
"fef868465920f415f2c0652d6910d3af288a0367"
get "/no_session_access"
assert_response :success
......
......@@ -35,7 +35,7 @@ def url_for(options = nil) # :nodoc:
when :back
_back_url
else
raise ArgumentError, "arguments passed to url_for can't be handled. Please require " +
raise ArgumentError, "arguments passed to url_for can't be handled. Please require " \
"routes or provide your own implementation"
end
end
......
......@@ -532,11 +532,11 @@ def retrieve_variable(path, as)
[variable, variable_counter, variable_iteration]
end
IDENTIFIER_ERROR_MESSAGE = "The partial name (%s) is not a valid Ruby identifier; " +
IDENTIFIER_ERROR_MESSAGE = "The partial name (%s) is not a valid Ruby identifier; " \
"make sure your partial name starts with underscore."
OPTION_AS_ERROR_MESSAGE = "The value (%s) of the option `as` is not a valid Ruby identifier; " +
"make sure it starts with lowercase letter, " +
OPTION_AS_ERROR_MESSAGE = "The value (%s) of the option `as` is not a valid Ruby identifier; " \
"make sure it starts with lowercase letter, " \
"and is followed by any combination of letters, numbers and underscores."
def raise_invalid_identifier(path)
......
......@@ -7,7 +7,7 @@ class Builder
def call(template)
require_engine
"xml = ::Builder::XmlMarkup.new(:indent => 2);" +
"xml = ::Builder::XmlMarkup.new(:indent => 2);" \
"self.output_buffer = xml.target!;" +
template.source +
";xml.target!;"
......
......@@ -45,7 +45,7 @@ def test_nested_fields_for_with_child_index_option_override_on_a_nested_attribut
end
expected = whole_form("/developers/123", "edit_developer_123", "edit_developer", method: "patch") do
'<input id="developer_projects_attributes_abc_name" name="developer[projects_attributes][abc][name]" type="text" value="project #321" />' +
'<input id="developer_projects_attributes_abc_name" name="developer[projects_attributes][abc][name]" type="text" value="project #321" />' \
'<input id="developer_projects_attributes_abc_id" name="developer[projects_attributes][abc][id]" type="hidden" value="321" />'
end
......
......@@ -393,30 +393,30 @@ def test_optgroups_with_with_options_with_hash
def test_time_zone_options_no_params
opts = time_zone_options_for_select
assert_dom_equal "<option value=\"A\">A</option>\n" +
"<option value=\"B\">B</option>\n" +
"<option value=\"C\">C</option>\n" +
"<option value=\"D\">D</option>\n" +
assert_dom_equal "<option value=\"A\">A</option>\n" \
"<option value=\"B\">B</option>\n" \
"<option value=\"C\">C</option>\n" \
"<option value=\"D\">D</option>\n" \
"<option value=\"E\">E</option>",
opts
end
def test_time_zone_options_with_selected
opts = time_zone_options_for_select("D")
assert_dom_equal "<option value=\"A\">A</option>\n" +
"<option value=\"B\">B</option>\n" +
"<option value=\"C\">C</option>\n" +
"<option value=\"D\" selected=\"selected\">D</option>\n" +
assert_dom_equal "<option value=\"A\">A</option>\n" \
"<option value=\"B\">B</option>\n" \
"<option value=\"C\">C</option>\n" \
"<option value=\"D\" selected=\"selected\">D</option>\n" \
"<option value=\"E\">E</option>",
opts
end
def test_time_zone_options_with_unknown_selected
opts = time_zone_options_for_select("K")
assert_dom_equal "<option value=\"A\">A</option>\n" +
"<option value=\"B\">B</option>\n" +
"<option value=\"C\">C</option>\n" +
"<option value=\"D\">D</option>\n" +
assert_dom_equal "<option value=\"A\">A</option>\n" \
"<option value=\"B\">B</option>\n" \
"<option value=\"C\">C</option>\n" \
"<option value=\"D\">D</option>\n" \
"<option value=\"E\">E</option>",
opts
end
......@@ -424,11 +424,11 @@ def test_time_zone_options_with_unknown_selected
def test_time_zone_options_with_priority_zones
zones = [ ActiveSupport::TimeZone.new("B"), ActiveSupport::TimeZone.new("E") ]
opts = time_zone_options_for_select(nil, zones)
assert_dom_equal "<option value=\"B\">B</option>\n" +
"<option value=\"E\">E</option>" +
"<option value=\"\" disabled=\"disabled\">-------------</option>\n" +
"<option value=\"A\">A</option>\n" +
"<option value=\"C\">C</option>\n" +
assert_dom_equal "<option value=\"B\">B</option>\n" \
"<option value=\"E\">E</option>" \
"<option value=\"\" disabled=\"disabled\">-------------</option>\n" \
"<option value=\"A\">A</option>\n" \
"<option value=\"C\">C</option>\n" \
"<option value=\"D\">D</option>",
opts
end
......@@ -436,11 +436,11 @@ def test_time_zone_options_with_priority_zones
def test_time_zone_options_with_selected_priority_zones
zones = [ ActiveSupport::TimeZone.new("B"), ActiveSupport::TimeZone.new("E") ]
opts = time_zone_options_for_select("E", zones)
assert_dom_equal "<option value=\"B\">B</option>\n" +
"<option value=\"E\" selected=\"selected\">E</option>" +
"<option value=\"\" disabled=\"disabled\">-------------</option>\n" +
"<option value=\"A\">A</option>\n" +
"<option value=\"C\">C</option>\n" +
assert_dom_equal "<option value=\"B\">B</option>\n" \
"<option value=\"E\" selected=\"selected\">E</option>" \
"<option value=\"\" disabled=\"disabled\">-------------</option>\n" \
"<option value=\"A\">A</option>\n" \
"<option value=\"C\">C</option>\n" \
"<option value=\"D\">D</option>",
opts
end
......@@ -448,11 +448,11 @@ def test_time_zone_options_with_selected_priority_zones
def test_time_zone_options_with_unselected_priority_zones
zones = [ ActiveSupport::TimeZone.new("B"), ActiveSupport::TimeZone.new("E") ]
opts = time_zone_options_for_select("C", zones)
assert_dom_equal "<option value=\"B\">B</option>\n" +
"<option value=\"E\">E</option>" +
"<option value=\"\" disabled=\"disabled\">-------------</option>\n" +
"<option value=\"A\">A</option>\n" +
"<option value=\"C\" selected=\"selected\">C</option>\n" +
assert_dom_equal "<option value=\"B\">B</option>\n" \
"<option value=\"E\">E</option>" \
"<option value=\"\" disabled=\"disabled\">-------------</option>\n" \
"<option value=\"A\">A</option>\n" \
"<option value=\"C\" selected=\"selected\">C</option>\n" \
"<option value=\"D\">D</option>",
opts
end
......@@ -1031,12 +1031,12 @@ def test_collection_select_with_proc_for_text_method
def test_time_zone_select
@firm = Firm.new("D")
html = time_zone_select("firm", "time_zone")
assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\">" +
"<option value=\"A\">A</option>\n" +
"<option value=\"B\">B</option>\n" +
"<option value=\"C\">C</option>\n" +
"<option value=\"D\" selected=\"selected\">D</option>\n" +
"<option value=\"E\">E</option>" +
assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\">" \
"<option value=\"A\">A</option>\n" \
"<option value=\"B\">B</option>\n" \
"<option value=\"C\">C</option>\n" \
"<option value=\"D\" selected=\"selected\">D</option>\n" \
"<option value=\"E\">E</option>" \
"</select>",
html
end
......@@ -1049,12 +1049,12 @@ def test_time_zone_select_under_fields_for
end
assert_dom_equal(
"<select id=\"firm_time_zone\" name=\"firm[time_zone]\">" +
"<option value=\"A\">A</option>\n" +
"<option value=\"B\">B</option>\n" +
"<option value=\"C\">C</option>\n" +
"<option value=\"D\" selected=\"selected\">D</option>\n" +
"<option value=\"E\">E</option>" +
"<select id=\"firm_time_zone\" name=\"firm[time_zone]\">" \
"<option value=\"A\">A</option>\n" \
"<option value=\"B\">B</option>\n" \
"<option value=\"C\">C</option>\n" \
"<option value=\"D\" selected=\"selected\">D</option>\n" \
"<option value=\"E\">E</option>" \
"</select>",
output_buffer
)
......@@ -1068,12 +1068,12 @@ def test_time_zone_select_under_fields_for_with_index
end
assert_dom_equal(
"<select id=\"firm_305_time_zone\" name=\"firm[305][time_zone]\">" +
"<option value=\"A\">A</option>\n" +
"<option value=\"B\">B</option>\n" +
"<option value=\"C\">C</option>\n" +
"<option value=\"D\" selected=\"selected\">D</option>\n" +
"<option value=\"E\">E</option>" +
"<select id=\"firm_305_time_zone\" name=\"firm[305][time_zone]\">" \
"<option value=\"A\">A</option>\n" \
"<option value=\"B\">B</option>\n" \
"<option value=\"C\">C</option>\n" \
"<option value=\"D\" selected=\"selected\">D</option>\n" \
"<option value=\"E\">E</option>" \
"</select>",
output_buffer
)
......@@ -1088,12 +1088,12 @@ def @firm.to_param; 305; end
end
assert_dom_equal(
"<select id=\"firm_305_time_zone\" name=\"firm[305][time_zone]\">" +
"<option value=\"A\">A</option>\n" +
"<option value=\"B\">B</option>\n" +
"<option value=\"C\">C</option>\n" +
"<option value=\"D\" selected=\"selected\">D</option>\n" +
"<option value=\"E\">E</option>" +
"<select id=\"firm_305_time_zone\" name=\"firm[305][time_zone]\">" \
"<option value=\"A\">A</option>\n" \
"<option value=\"B\">B</option>\n" \
"<option value=\"C\">C</option>\n" \
"<option value=\"D\" selected=\"selected\">D</option>\n" \
"<option value=\"E\">E</option>" \
"</select>",
output_buffer
)
......@@ -1102,13 +1102,13 @@ def @firm.to_param; 305; end
def test_time_zone_select_with_blank
@firm = Firm.new("D")
html = time_zone_select("firm", "time_zone", nil, include_blank: true)
assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\">" +
"<option value=\"\"></option>\n" +
"<option value=\"A\">A</option>\n" +
"<option value=\"B\">B</option>\n" +
"<option value=\"C\">C</option>\n" +
"<option value=\"D\" selected=\"selected\">D</option>\n" +
"<option value=\"E\">E</option>" +
assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\">" \
"<option value=\"\"></option>\n" \
"<option value=\"A\">A</option>\n" \
"<option value=\"B\">B</option>\n" \
"<option value=\"C\">C</option>\n" \
"<option value=\"D\" selected=\"selected\">D</option>\n" \
"<option value=\"E\">E</option>" \
"</select>",
html
end
......@@ -1116,13 +1116,13 @@ def test_time_zone_select_with_blank
def test_time_zone_select_with_blank_as_string
@firm = Firm.new("D")
html = time_zone_select("firm", "time_zone", nil, include_blank: "No Zone")
assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\">" +
"<option value=\"\">No Zone</option>\n" +
"<option value=\"A\">A</option>\n" +
"<option value=\"B\">B</option>\n" +
"<option value=\"C\">C</option>\n" +
"<option value=\"D\" selected=\"selected\">D</option>\n" +
"<option value=\"E\">E</option>" +
assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\">" \
"<option value=\"\">No Zone</option>\n" \
"<option value=\"A\">A</option>\n" \
"<option value=\"B\">B</option>\n" \
"<option value=\"C\">C</option>\n" \
"<option value=\"D\" selected=\"selected\">D</option>\n" \
"<option value=\"E\">E</option>" \
"</select>",
html
end
......@@ -1131,12 +1131,12 @@ def test_time_zone_select_with_style
@firm = Firm.new("D")
html = time_zone_select("firm", "time_zone", nil, {},
"style" => "color: red")
assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\" style=\"color: red\">" +
"<option value=\"A\">A</option>\n" +
"<option value=\"B\">B</option>\n" +
"<option value=\"C\">C</option>\n" +
"<option value=\"D\" selected=\"selected\">D</option>\n" +
"<option value=\"E\">E</option>" +
assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\" style=\"color: red\">" \
"<option value=\"A\">A</option>\n" \
"<option value=\"B\">B</option>\n" \
"<option value=\"C\">C</option>\n" \
"<option value=\"D\" selected=\"selected\">D</option>\n" \
"<option value=\"E\">E</option>" \
"</select>",
html
assert_dom_equal html, time_zone_select("firm", "time_zone", nil, {},
......@@ -1147,13 +1147,13 @@ def test_time_zone_select_with_blank_and_style
@firm = Firm.new("D")
html = time_zone_select("firm", "time_zone", nil,
{ include_blank: true }, "style" => "color: red")
assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\" style=\"color: red\">" +
"<option value=\"\"></option>\n" +
"<option value=\"A\">A</option>\n" +
"<option value=\"B\">B</option>\n" +
"<option value=\"C\">C</option>\n" +
"<option value=\"D\" selected=\"selected\">D</option>\n" +
"<option value=\"E\">E</option>" +
assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\" style=\"color: red\">" \
"<option value=\"\"></option>\n" \
"<option value=\"A\">A</option>\n" \
"<option value=\"B\">B</option>\n" \
"<option value=\"C\">C</option>\n" \
"<option value=\"D\" selected=\"selected\">D</option>\n" \
"<option value=\"E\">E</option>" \
"</select>",
html
assert_dom_equal html, time_zone_select("firm", "time_zone", nil,
......@@ -1164,13 +1164,13 @@ def test_time_zone_select_with_blank_as_string_and_style
@firm = Firm.new("D")
html = time_zone_select("firm", "time_zone", nil,
{ include_blank: "No Zone" }, "style" => "color: red")
assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\" style=\"color: red\">" +
"<option value=\"\">No Zone</option>\n" +
"<option value=\"A\">A</option>\n" +
"<option value=\"B\">B</option>\n" +
"<option value=\"C\">C</option>\n" +
"<option value=\"D\" selected=\"selected\">D</option>\n" +
"<option value=\"E\">E</option>" +
assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\" style=\"color: red\">" \
"<option value=\"\">No Zone</option>\n" \
"<option value=\"A\">A</option>\n" \
"<option value=\"B\">B</option>\n" \
"<option value=\"C\">C</option>\n" \
"<option value=\"D\" selected=\"selected\">D</option>\n" \
"<option value=\"E\">E</option>" \
"</select>",
html
assert_dom_equal html, time_zone_select("firm", "time_zone", nil,
......@@ -1181,13 +1181,13 @@ def test_time_zone_select_with_priority_zones
@firm = Firm.new("D")
zones = [ ActiveSupport::TimeZone.new("A"), ActiveSupport::TimeZone.new("D") ]
html = time_zone_select("firm", "time_zone", zones)
assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\">" +
"<option value=\"A\">A</option>\n" +
"<option value=\"D\" selected=\"selected\">D</option>" +
"<option value=\"\" disabled=\"disabled\">-------------</option>\n" +
"<option value=\"B\">B</option>\n" +
"<option value=\"C\">C</option>\n" +
"<option value=\"E\">E</option>" +
assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\">" \
"<option value=\"A\">A</option>\n" \
"<option value=\"D\" selected=\"selected\">D</option>" \
"<option value=\"\" disabled=\"disabled\">-------------</option>\n" \
"<option value=\"B\">B</option>\n" \
"<option value=\"C\">C</option>\n" \
"<option value=\"E\">E</option>" \
"</select>",
html
end
......@@ -1200,13 +1200,13 @@ def tz.=~(re); %(A D).include?(name) end
end
html = time_zone_select("firm", "time_zone", /A|D/)
assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\">" +
"<option value=\"A\">A</option>\n" +
"<option value=\"D\" selected=\"selected\">D</option>" +
"<option value=\"\" disabled=\"disabled\">-------------</option>\n" +
"<option value=\"B\">B</option>\n" +
"<option value=\"C\">C</option>\n" +
"<option value=\"E\">E</option>" +
assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\">" \
"<option value=\"A\">A</option>\n" \
"<option value=\"D\" selected=\"selected\">D</option>" \
"<option value=\"\" disabled=\"disabled\">-------------</option>\n" \
"<option value=\"B\">B</option>\n" \
"<option value=\"C\">C</option>\n" \
"<option value=\"E\">E</option>" \
"</select>",
html
end
......@@ -1221,13 +1221,13 @@ def tz.===(zone); raise Exception; end
end
html = time_zone_select("firm", "time_zone", /A|D/)
assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\">" +
"<option value=\"\" disabled=\"disabled\">-------------</option>\n" +
"<option value=\"A\">A</option>\n" +
"<option value=\"B\">B</option>\n" +
"<option value=\"C\">C</option>\n" +
"<option value=\"D\" selected=\"selected\">D</option>\n" +
"<option value=\"E\">E</option>" +
assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\">" \
"<option value=\"\" disabled=\"disabled\">-------------</option>\n" \
"<option value=\"A\">A</option>\n" \
"<option value=\"B\">B</option>\n" \
"<option value=\"C\">C</option>\n" \
"<option value=\"D\" selected=\"selected\">D</option>\n" \
"<option value=\"E\">E</option>" \
"</select>",
html
end
......@@ -1237,12 +1237,12 @@ def test_time_zone_select_with_default_time_zone_and_nil_value
@firm.time_zone = nil
html = time_zone_select("firm", "time_zone", nil, default: "B")
assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\">" +
"<option value=\"A\">A</option>\n" +
"<option value=\"B\" selected=\"selected\">B</option>\n" +
"<option value=\"C\">C</option>\n" +
"<option value=\"D\">D</option>\n" +
"<option value=\"E\">E</option>" +
assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\">" \
"<option value=\"A\">A</option>\n" \
"<option value=\"B\" selected=\"selected\">B</option>\n" \
"<option value=\"C\">C</option>\n" \
"<option value=\"D\">D</option>\n" \
"<option value=\"E\">E</option>" \
"</select>",
html
end
......@@ -1251,12 +1251,12 @@ def test_time_zone_select_with_default_time_zone_and_value
@firm = Firm.new("D")
html = time_zone_select("firm", "time_zone", nil, default: "B")
assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\">" +
"<option value=\"A\">A</option>\n" +
"<option value=\"B\">B</option>\n" +
"<option value=\"C\">C</option>\n" +
"<option value=\"D\" selected=\"selected\">D</option>\n" +
"<option value=\"E\">E</option>" +
assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\">" \
"<option value=\"A\">A</option>\n" \
"<option value=\"B\">B</option>\n" \
"<option value=\"C\">C</option>\n" \
"<option value=\"D\" selected=\"selected\">D</option>\n" \
"<option value=\"E\">E</option>" \
"</select>",
html
end
......
......@@ -220,15 +220,15 @@ def test_render_partial_with_unicode_text
def test_render_partial_with_invalid_option_as
e = assert_raises(ArgumentError) { @view.render(partial: "test/partial_only", as: "a-in") }
assert_equal "The value (a-in) of the option `as` is not a valid Ruby identifier; " +
"make sure it starts with lowercase letter, " +
assert_equal "The value (a-in) of the option `as` is not a valid Ruby identifier; " \
"make sure it starts with lowercase letter, " \
"and is followed by any combination of letters, numbers and underscores.", e.message
end
def test_render_partial_with_hyphen_and_invalid_option_as
e = assert_raises(ArgumentError) { @view.render(partial: "test/a-in", as: "a-in") }
assert_equal "The value (a-in) of the option `as` is not a valid Ruby identifier; " +
"make sure it starts with lowercase letter, " +
assert_equal "The value (a-in) of the option `as` is not a valid Ruby identifier; " \
"make sure it starts with lowercase letter, " \
"and is followed by any combination of letters, numbers and underscores.", e.message
end
......@@ -424,7 +424,7 @@ def test_render_fallbacks_to_erb_for_unknown_types
end
CustomHandler = lambda do |template|
"@output_buffer = ''\n" +
"@output_buffer = ''\n" \
"@output_buffer << 'source: #{template.source.inspect}'\n"
end
......
......@@ -821,7 +821,7 @@ def show
private
def render_default
render inline: "<%= link_to_unless_current('tasks', tasks_path) %>\n" +
render inline: "<%= link_to_unless_current('tasks', tasks_path) %>\n" \
"<%= link_to_unless_current('tasks', tasks_url) %>"
end
end
......
......@@ -85,7 +85,7 @@ def remove_target!(method)
if target.persisted? && owner.persisted? && !target.save
set_owner_attributes(target)
raise RecordNotSaved, "Failed to remove the existing associated #{reflection.name}. " +
raise RecordNotSaved, "Failed to remove the existing associated #{reflection.name}. " \
"The record failed to save after its foreign key was set to nil."
end
end
......
......@@ -176,7 +176,7 @@ def lease
if @owner == Thread.current
msg << "it is already leased by the current thread."
else
msg << "it is already in use by a different thread: #{@owner}. " <<
msg << "it is already in use by a different thread: #{@owner}. " \
"Current thread: #{Thread.current}."
end
raise ActiveRecordError, msg
......@@ -194,8 +194,8 @@ def schema_cache=(cache)
def expire
if in_use?
if @owner != Thread.current
raise ActiveRecordError, "Cannot expire connection, " <<
"it is owned by a different thread: #{@owner}. " <<
raise ActiveRecordError, "Cannot expire connection, " \
"it is owned by a different thread: #{@owner}. " \
"Current thread: #{Thread.current}."
end
......
......@@ -267,8 +267,8 @@ def load_seed
if seed_loader
seed_loader.load_seed
else
raise "You tried to load seed data, but no seed loader is specified. Please specify seed " +
"loader with ActiveRecord::Tasks::DatabaseTasks.seed_loader = your_seed_loader\n" +
raise "You tried to load seed data, but no seed loader is specified. Please specify seed " \
"loader with ActiveRecord::Tasks::DatabaseTasks.seed_loader = your_seed_loader\n" \
"Seed loader should respond to load_seed method"
end
end
......
......@@ -156,7 +156,7 @@ def test_reconnection_after_actual_disconnection_with_verify
secondary_connection.query("select pg_terminate_backend(#{original_connection_pid.first.first})")
ActiveRecord::Base.connection_pool.checkin(secondary_connection)
elsif ARTest.config["with_manual_interventions"]
puts "Kill the connection now (e.g. by restarting the PostgreSQL " +
puts "Kill the connection now (e.g. by restarting the PostgreSQL " \
'server with the "-m fast" option) and then press enter.'
$stdin.gets
else
......@@ -175,7 +175,7 @@ def test_reconnection_after_actual_disconnection_with_verify
new_connection_pid = @connection.query("select pg_backend_pid()")
assert_not_equal original_connection_pid, new_connection_pid,
"umm -- looks like you didn't break the connection, because we're still " +
"umm -- looks like you didn't break the connection, because we're still " \
"successfully querying with the same connection pid."
# Repair all fixture connections so other tests won't break.
......
......@@ -476,7 +476,7 @@ def test_replacement_failure_due_to_existing_record_should_raise_error
assert_equal ships(:black_pearl), pirate.ship
assert_equal pirate.id, pirate.ship.pirate_id
assert_equal "Failed to remove the existing associated ship. " +
assert_equal "Failed to remove the existing associated ship. " \
"The record failed to save after its foreign key was set to nil.", error.message
end
......
......@@ -399,7 +399,7 @@ def test_concurrent_connection_establishment
all_threads_in_new_connection.wait
end
rescue Timeout::Error
flunk "pool unable to establish connections concurrently or implementation has " <<
flunk "pool unable to establish connections concurrently or implementation has " \
"changed, this test then needs to patch a different :new_connection method"
ensure
# clean up the threads
......
......@@ -120,14 +120,14 @@ def assert_callbacks_not_called
assert_assignment_affects_records_in_target(:birds_with_add)
end
test("Assignment updates records in target when not loaded" +
test("Assignment updates records in target when not loaded" \
" and callback loads target") do
assert_not @pirate.birds_with_add_load.loaded?
@pirate.birds_with_add_load_attributes = update_new_and_destroy_bird_attributes
assert_assignment_affects_records_in_target(:birds_with_add_load)
end
test("Assignment updates records in target when loaded" +
test("Assignment updates records in target when loaded" \
" and callback loads target") do
@pirate.birds_with_add_load.load_target
@pirate.birds_with_add_load_attributes = update_new_and_destroy_bird_attributes
......
......@@ -222,7 +222,7 @@ def test_string_squish
original = %{\u205f\u3000 A string surrounded by various unicode spaces,
with tabs(\t\t), newlines(\n\n), unicode nextlines(\u0085\u0085) and many spaces( ). \u00a0\u2007}
expected = "A string surrounded by various unicode spaces, " +
expected = "A string surrounded by various unicode spaces, " \
"with tabs( ), newlines( ), unicode nextlines( ) and many spaces( )."
# Make sure squish returns what we expect:
......
......@@ -511,7 +511,7 @@ def default_middleware_stack #:nodoc:
def validate_secret_key_config! #:nodoc:
if secrets.secret_key_base.blank?
ActiveSupport::Deprecation.warn "You didn't set `secret_key_base`. " +
ActiveSupport::Deprecation.warn "You didn't set `secret_key_base`. " \
"Read the upgrade documentation to learn more about this new config option."
if secrets.secret_token.blank?
......
......@@ -48,8 +48,8 @@ module Bootstrap
logger = ActiveSupport::TaggedLogging.new(ActiveSupport::Logger.new(STDERR))
logger.level = ActiveSupport::Logger::WARN
logger.warn(
"Rails Error: Unable to access log file. Please ensure that #{path} exists and is writable " +
"(ie, make it writable for user and group: chmod 0664 #{path}). " +
"Rails Error: Unable to access log file. Please ensure that #{path} exists and is writable " \
"(ie, make it writable for user and group: chmod 0664 #{path}). " \
"The log level has been raised to WARN and the output directed to STDERR until the problem is fixed."
)
logger
......
......@@ -54,8 +54,8 @@ def on_conflict_behavior # :doc:
say_status :skip, :yellow
else
say_status :conflict, :red
raise Error, "Another migration is already named #{migration_file_name}: " +
"#{existing_migration}. Use --force to replace this migration " +
raise Error, "Another migration is already named #{migration_file_name}: " \
"#{existing_migration}. Use --force to replace this migration " \
"or --skip to ignore conflicted file."
end
end
......
......@@ -256,8 +256,8 @@ def class_collisions(*class_names)
last = extract_last_module(nesting)
if last && last.const_defined?(last_name.camelize, false)
raise Error, "The name '#{class_name}' is either already used in your application " <<
"or reserved by Ruby on Rails. Please choose an alternative and run " <<
raise Error, "The name '#{class_name}' is either already used in your application " \
"or reserved by Ruby on Rails. Please choose an alternative and run " \
"this generator again."
end
end
......
......@@ -186,7 +186,7 @@ class PluginGenerator < AppBase # :nodoc:
desc: "Skip gemspec file"
class_option :skip_gemfile_entry, type: :boolean, default: false,
desc: "If creating plugin in application's directory " +
desc: "If creating plugin in application's directory " \
"skip adding entry to Gemfile"
class_option :api, type: :boolean, default: false,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册