提交 583ddf22 编写于 作者: E Emilio Tagua

Remove more warnings shadowing outer local variable.

上级 dafb4bd3
......@@ -96,9 +96,9 @@ def all_application_helpers
def all_helpers_from_path(path)
helpers = []
Array.wrap(path).each do |path|
extract = /^#{Regexp.quote(path.to_s)}\/?(.*)_helper.rb$/
helpers += Dir["#{path}/**/*_helper.rb"].map { |file| file.sub(extract, '\1') }
Array.wrap(path).each do |p|
extract = /^#{Regexp.quote(p.to_s)}\/?(.*)_helper.rb$/
helpers += Dir["#{p}/**/*_helper.rb"].map { |file| file.sub(extract, '\1') }
end
helpers.sort!
helpers.uniq!
......
......@@ -18,12 +18,12 @@ def initialize(hash)
hash[k] = Conditions.new(v)
when :children
hash[k] = v = keys_to_symbols(v)
v.each do |k,v2|
case k
v.each do |key,v2|
case key
when :count, :greater_than, :less_than
# keys are valid, and require no further processing
when :only
v[k] = Conditions.new(v2)
v[key] = Conditions.new(v2)
else
raise "illegal key #{k.inspect} => #{v2.inspect}"
end
......
......@@ -513,8 +513,8 @@ def assert_select_encoded(element = nil, &block)
node.content.gsub(/<!\[CDATA\[(.*)(\]\]>)?/m) { Rack::Utils.escapeHTML($1) }
end
selected = elements.map do |element|
text = element.children.select{ |c| not c.tag? }.map{ |c| fix_content[c] }.join
selected = elements.map do |ele|
text = ele.children.select{ |c| not c.tag? }.map{ |c| fix_content[c] }.join
root = HTML::Document.new(CGI.unescapeHTML("<encoded>#{text}</encoded>")).root
css_select(root, "encoded:root", &block)[0]
end
......
......@@ -120,10 +120,10 @@ def setup
end
test "read cache control" do
resp = ActionDispatch::Response.new.tap { |resp|
resp.cache_control[:public] = true
resp.etag = '123'
resp.body = 'Hello'
resp = ActionDispatch::Response.new.tap { |_resp|
_resp.cache_control[:public] = true
_resp.etag = '123'
_resp.body = 'Hello'
}
resp.to_a
......@@ -135,10 +135,10 @@ def setup
end
test "read charset and content type" do
resp = ActionDispatch::Response.new.tap { |resp|
resp.charset = 'utf-16'
resp.content_type = Mime::XML
resp.body = 'Hello'
resp = ActionDispatch::Response.new.tap { |_resp|
_resp.charset = 'utf-16'
_resp.content_type = Mime::XML
_resp.body = 'Hello'
}
resp.to_a
......
......@@ -491,7 +491,7 @@ def test_auto_link_with_block
url = "http://api.rubyonrails.com/Foo.html"
email = "fantabulous@shiznadel.ic"
assert_equal %(<p><a href="#{url}">#{url[0...7]}...</a><br /><a href="mailto:#{email}">#{email[0...7]}...</a><br /></p>), auto_link("<p>#{url}<br />#{email}<br /></p>") { |url| truncate(url, :length => 10) }
assert_equal %(<p><a href="#{url}">#{url[0...7]}...</a><br /><a href="mailto:#{email}">#{email[0...7]}...</a><br /></p>), auto_link("<p>#{url}<br />#{email}<br /></p>") { |u| truncate(u, :length => 10) }
end
def test_auto_link_with_block_with_html
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册