aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2011-06-07 21:39:55 -0300
committerSantiago Pastorino <santiago@wyeworks.com>2011-06-08 00:26:09 -0300
commit1d3618a9b47d3160af00992756a4487906e39bcb (patch)
tree9ab0d0b449229f4a470f57f337ce133ed9b48932 /actionpack
parentf2f63bf2ffa00d6187405c5851713d9fee68d5d3 (diff)
downloadrails-1d3618a9b47d3160af00992756a4487906e39bcb.tar.gz
rails-1d3618a9b47d3160af00992756a4487906e39bcb.tar.bz2
rails-1d3618a9b47d3160af00992756a4487906e39bcb.zip
remove warning: assigned but unused variable
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller/caching/fragments.rb1
-rw-r--r--actionpack/lib/action_controller/metal/http_authentication.rb2
-rw-r--r--actionpack/lib/action_dispatch/middleware/head.rb2
-rw-r--r--actionpack/lib/action_dispatch/testing/integration.rb3
-rw-r--r--actionpack/lib/action_view/helpers/debug_helper.rb2
-rw-r--r--actionpack/lib/action_view/renderer/template_renderer.rb2
-rw-r--r--actionpack/lib/action_view/template/error.rb1
-rw-r--r--actionpack/test/dispatch/session/test_session_test.rb1
-rw-r--r--actionpack/test/template/html-scanner/document_test.rb4
-rw-r--r--actionpack/test/template/record_tag_helper_test.rb2
-rw-r--r--actionpack/test/template/render_test.rb4
-rw-r--r--actionpack/test/template/template_test.rb1
-rw-r--r--actionpack/test/template/text_helper_test.rb4
13 files changed, 10 insertions, 19 deletions
diff --git a/actionpack/lib/action_controller/caching/fragments.rb b/actionpack/lib/action_controller/caching/fragments.rb
index 0be04b70a1..2bdb23c4d7 100644
--- a/actionpack/lib/action_controller/caching/fragments.rb
+++ b/actionpack/lib/action_controller/caching/fragments.rb
@@ -109,7 +109,6 @@ module ActionController #:nodoc:
def expire_fragment(key, options = nil)
return unless cache_configured?
key = fragment_cache_key(key) unless key.is_a?(Regexp)
- message = nil
instrument_fragment_cache :expire_fragment, key do
if key.is_a?(Regexp)
diff --git a/actionpack/lib/action_controller/metal/http_authentication.rb b/actionpack/lib/action_controller/metal/http_authentication.rb
index 6d0c163a9e..7420a5e7e9 100644
--- a/actionpack/lib/action_controller/metal/http_authentication.rb
+++ b/actionpack/lib/action_controller/metal/http_authentication.rb
@@ -423,7 +423,7 @@ module ActionController
# Returns an Array of [String, Hash] if a token is present.
# Returns nil if no token is found.
def token_and_options(request)
- if header = request.authorization.to_s[/^Token (.*)/]
+ if request.authorization.to_s[/^Token (.*)/]
values = Hash[$1.split(',').map do |value|
value.strip! # remove any spaces between commas and values
key, value = value.split(/\=\"?/) # split key=value pairs
diff --git a/actionpack/lib/action_dispatch/middleware/head.rb b/actionpack/lib/action_dispatch/middleware/head.rb
index 56e2d2f2a8..f1906a3ab3 100644
--- a/actionpack/lib/action_dispatch/middleware/head.rb
+++ b/actionpack/lib/action_dispatch/middleware/head.rb
@@ -8,7 +8,7 @@ module ActionDispatch
if env["REQUEST_METHOD"] == "HEAD"
env["REQUEST_METHOD"] = "GET"
env["rack.methodoverride.original_method"] = "HEAD"
- status, headers, body = @app.call(env)
+ status, headers, _ = @app.call(env)
[status, headers, []]
else
@app.call(env)
diff --git a/actionpack/lib/action_dispatch/testing/integration.rb b/actionpack/lib/action_dispatch/testing/integration.rb
index 9791ba58e2..aae5752c93 100644
--- a/actionpack/lib/action_dispatch/testing/integration.rb
+++ b/actionpack/lib/action_dispatch/testing/integration.rb
@@ -207,9 +207,6 @@ module ActionDispatch
"*/*;q=0.5"
unless defined? @named_routes_configured
- # install the named routes in this session instance.
- klass = singleton_class
-
# the helpers are made protected by default--we make them public for
# easier access during testing and troubleshooting.
@named_routes_configured = true
diff --git a/actionpack/lib/action_view/helpers/debug_helper.rb b/actionpack/lib/action_view/helpers/debug_helper.rb
index cd67851642..c0cc7d347c 100644
--- a/actionpack/lib/action_view/helpers/debug_helper.rb
+++ b/actionpack/lib/action_view/helpers/debug_helper.rb
@@ -30,7 +30,7 @@ module ActionView
begin
Marshal::dump(object)
"<pre class='debug_dump'>#{h(object.to_yaml).gsub(" ", "&nbsp; ")}</pre>".html_safe
- rescue Exception => e # errors from Marshal or YAML
+ rescue Exception # errors from Marshal or YAML
# Object couldn't be dumped, perhaps because of singleton methods -- this is the fallback
"<code class='debug_dump'>#{h(object.inspect)}</code>".html_safe
end
diff --git a/actionpack/lib/action_view/renderer/template_renderer.rb b/actionpack/lib/action_view/renderer/template_renderer.rb
index a09cef8fef..d04c00fd40 100644
--- a/actionpack/lib/action_view/renderer/template_renderer.rb
+++ b/actionpack/lib/action_view/renderer/template_renderer.rb
@@ -64,7 +64,7 @@ module ActionView
layout =~ /^\// ?
with_fallbacks { find_template(layout, nil, false, keys) } : find_template(layout, nil, false, keys)
end
- rescue ActionView::MissingTemplate => e
+ rescue ActionView::MissingTemplate
update_details(:formats => nil) do
raise unless template_exists?(layout)
end
diff --git a/actionpack/lib/action_view/template/error.rb b/actionpack/lib/action_view/template/error.rb
index d4448a7b33..587e37a84f 100644
--- a/actionpack/lib/action_view/template/error.rb
+++ b/actionpack/lib/action_view/template/error.rb
@@ -31,7 +31,6 @@ module ActionView
def initialize(paths, path, prefixes, partial, details, *)
@path = path
prefixes = Array.wrap(prefixes)
- display_paths = paths.compact.map{ |p| p.to_s.inspect }.join(", ")
template_type = if partial
"partial"
elsif path =~ /layouts/i
diff --git a/actionpack/test/dispatch/session/test_session_test.rb b/actionpack/test/dispatch/session/test_session_test.rb
index 31ce97a25b..904398f563 100644
--- a/actionpack/test/dispatch/session/test_session_test.rb
+++ b/actionpack/test/dispatch/session/test_session_test.rb
@@ -29,7 +29,6 @@ class ActionController::TestSessionTest < ActiveSupport::TestCase
end
def test_clear_emptys_session
- params = {:one => 'one', :two => 'two'}
session = ActionController::TestSession.new({:one => 'one', :two => 'two'})
session.clear
assert_nil(session[:one])
diff --git a/actionpack/test/template/html-scanner/document_test.rb b/actionpack/test/template/html-scanner/document_test.rb
index ddfb351595..3db2fba783 100644
--- a/actionpack/test/template/html-scanner/document_test.rb
+++ b/actionpack/test/template/html-scanner/document_test.rb
@@ -123,7 +123,7 @@ HTML
def test_parse_invalid_document
assert_nothing_raised do
- doc = HTML::Document.new("<html>
+ HTML::Document.new("<html>
<table>
<tr>
<td style=\"color: #FFFFFF; height: 17px; onclick=\"window.location.href='http://www.rmeinc.com/about_rme.aspx'\" style=\"cursor:pointer; height: 17px;\"; nowrap onclick=\"window.location.href='http://www.rmeinc.com/about_rme.aspx'\" onmouseout=\"this.bgColor='#0066cc'; this.style.color='#FFFFFF'\" onmouseover=\"this.bgColor='#ffffff'; this.style.color='#0033cc'\">About Us</td>
@@ -135,7 +135,7 @@ HTML
def test_invalid_document_raises_exception_when_strict
assert_raise RuntimeError do
- doc = HTML::Document.new("<html>
+ HTML::Document.new("<html>
<table>
<tr>
<td style=\"color: #FFFFFF; height: 17px; onclick=\"window.location.href='http://www.rmeinc.com/about_rme.aspx'\" style=\"cursor:pointer; height: 17px;\"; nowrap onclick=\"window.location.href='http://www.rmeinc.com/about_rme.aspx'\" onmouseout=\"this.bgColor='#0066cc'; this.style.color='#FFFFFF'\" onmouseover=\"this.bgColor='#ffffff'; this.style.color='#0033cc'\">About Us</td>
diff --git a/actionpack/test/template/record_tag_helper_test.rb b/actionpack/test/template/record_tag_helper_test.rb
index 74d7bba4fe..1ba14e8bc9 100644
--- a/actionpack/test/template/record_tag_helper_test.rb
+++ b/actionpack/test/template/record_tag_helper_test.rb
@@ -48,14 +48,12 @@ class RecordTagHelperTest < ActionView::TestCase
end
def test_block_works_with_content_tag_for_in_erb
- __in_erb_template = ''
expected = %(<tr class="post" id="post_45">#{@post.body}</tr>)
actual = content_tag_for(:tr, @post) { concat @post.body }
assert_dom_equal expected, actual
end
def test_div_for_in_erb
- __in_erb_template = ''
expected = %(<div class="post bar" id="post_45">#{@post.body}</div>)
actual = div_for(@post, :class => "bar") { concat @post.body }
assert_dom_equal expected, actual
diff --git a/actionpack/test/template/render_test.rb b/actionpack/test/template/render_test.rb
index 86d08a43a5..4187a0ac78 100644
--- a/actionpack/test/template/render_test.rb
+++ b/actionpack/test/template/render_test.rb
@@ -370,7 +370,7 @@ class LazyViewRenderTest < ActiveSupport::TestCase
def test_render_utf8_template_with_incompatible_external_encoding
with_external_encoding Encoding::SHIFT_JIS do
begin
- result = @view.render(:file => "test/utf8.html.erb", :layouts => "layouts/yield")
+ @view.render(:file => "test/utf8.html.erb", :layouts => "layouts/yield")
flunk 'Should have raised incompatible encoding error'
rescue ActionView::Template::Error => error
assert_match 'Your template was not saved as valid Shift_JIS', error.original_exception.message
@@ -381,7 +381,7 @@ class LazyViewRenderTest < ActiveSupport::TestCase
def test_render_utf8_template_with_partial_with_incompatible_encoding
with_external_encoding Encoding::SHIFT_JIS do
begin
- result = @view.render(:file => "test/utf8_magic_with_bare_partial.html.erb", :layouts => "layouts/yield")
+ @view.render(:file => "test/utf8_magic_with_bare_partial.html.erb", :layouts => "layouts/yield")
flunk 'Should have raised incompatible encoding error'
rescue ActionView::Template::Error => error
assert_match 'Your template was not saved as valid Shift_JIS', error.original_exception.message
diff --git a/actionpack/test/template/template_test.rb b/actionpack/test/template/template_test.rb
index 81fb34b80f..b0ca7de0b6 100644
--- a/actionpack/test/template/template_test.rb
+++ b/actionpack/test/template/template_test.rb
@@ -153,7 +153,6 @@ class TestERBTemplate < ActiveSupport::TestCase
def test_encoding_can_be_specified_with_magic_comment_in_erb
with_external_encoding Encoding::UTF_8 do
@template = new_template("<%# encoding: ISO-8859-1 %>hello \xFCmlat", :virtual_path => nil)
- result = render
assert_equal Encoding::UTF_8, render.encoding
assert_equal "hello \u{fc}mlat", render
end
diff --git a/actionpack/test/template/text_helper_test.rb b/actionpack/test/template/text_helper_test.rb
index 740f577a6e..5a43b5f864 100644
--- a/actionpack/test/template/text_helper_test.rb
+++ b/actionpack/test/template/text_helper_test.rb
@@ -291,7 +291,7 @@ class TextHelperTest < ActionView::TestCase
end
def test_cycle_class_with_no_arguments
- assert_raise(ArgumentError) { value = Cycle.new() }
+ assert_raise(ArgumentError) { Cycle.new }
end
def test_cycle
@@ -304,7 +304,7 @@ class TextHelperTest < ActionView::TestCase
end
def test_cycle_with_no_arguments
- assert_raise(ArgumentError) { value = cycle() }
+ assert_raise(ArgumentError) { cycle }
end
def test_cycle_resets_with_new_values