aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkennyj <kennyj@gmail.com>2012-02-10 20:55:10 +0900
committerkennyj <kennyj@gmail.com>2012-02-21 12:43:41 +0900
commit39d461703361834c2e51dd9179afce0f8a0a83ff (patch)
tree71a06a722a6259f946c3eaeca76dcb9c0c8d0384
parentb80d8f71112279f989ad3accbfed277a25cedd57 (diff)
downloadrails-39d461703361834c2e51dd9179afce0f8a0a83ff.tar.gz
rails-39d461703361834c2e51dd9179afce0f8a0a83ff.tar.bz2
rails-39d461703361834c2e51dd9179afce0f8a0a83ff.zip
Fix some warnings on 3-2-stable
-rw-r--r--actionpack/test/controller/base_test.rb6
-rw-r--r--actionpack/test/controller/content_type_test.rb4
-rw-r--r--actionpack/test/dispatch/routing_test.rb1
-rw-r--r--actionpack/test/template/record_tag_helper_test.rb41
-rw-r--r--activerecord/lib/active_record/counter_cache.rb2
-rw-r--r--activesupport/test/core_ext/range_ext_test.rb2
6 files changed, 29 insertions, 27 deletions
diff --git a/actionpack/test/controller/base_test.rb b/actionpack/test/controller/base_test.rb
index 777ca11d85..6f76ab9596 100644
--- a/actionpack/test/controller/base_test.rb
+++ b/actionpack/test/controller/base_test.rb
@@ -167,7 +167,7 @@ class PerformActionTest < ActionController::TestCase
def test_get_on_priv_should_show_selector
use_controller MethodMissingController
- assert_deprecated /Using `method_missing` to handle .* use `action_missing` instead/ do
+ assert_deprecated(/Using `method_missing` to handle .* use `action_missing` instead/) do
get :shouldnt_be_called
end
assert_response :success
@@ -178,7 +178,7 @@ class PerformActionTest < ActionController::TestCase
use_controller MethodMissingController
assert !@controller.__send__(:action_method?, 'method_missing')
- assert_deprecated /Using `method_missing` to handle .* use `action_missing` instead/ do
+ assert_deprecated(/Using `method_missing` to handle .* use `action_missing` instead/) do
get :method_missing
end
assert_response :success
@@ -187,7 +187,7 @@ class PerformActionTest < ActionController::TestCase
def test_method_missing_should_recieve_symbol
use_controller AnotherMethodMissingController
- assert_deprecated /Using `method_missing` to handle .* use `action_missing` instead/ do
+ assert_deprecated(/Using `method_missing` to handle .* use `action_missing` instead/) do
get :some_action
end
assert_kind_of NameError, @controller._exception
diff --git a/actionpack/test/controller/content_type_test.rb b/actionpack/test/controller/content_type_test.rb
index d0dabb29ca..e8e445532a 100644
--- a/actionpack/test/controller/content_type_test.rb
+++ b/actionpack/test/controller/content_type_test.rb
@@ -70,7 +70,7 @@ class ContentTypeTest < ActionController::TestCase
end
def test_render_changed_charset_default
- assert_deprecated /Setting default charset at controller.*config\.action_dispatch\.default_charset/ do
+ assert_deprecated(/Setting default charset at controller.*config\.action_dispatch\.default_charset/) do
begin
OldContentTypeController.default_charset = "utf-16"
get :render_defaults
@@ -111,7 +111,7 @@ class ContentTypeTest < ActionController::TestCase
end
def test_nil_default_for_erb
- assert_deprecated /Setting default charset at controller.*config\.action_dispatch\.default_charset/ do
+ assert_deprecated(/Setting default charset at controller.*config\.action_dispatch\.default_charset/) do
begin
OldContentTypeController.default_charset = nil
get :render_default_for_erb
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
index 3922e3628d..b96987410f 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -2574,7 +2574,6 @@ class TestUnicodePaths < ActionDispatch::IntegrationTest
Routes = ActionDispatch::Routing::RouteSet.new.tap do |app|
app.draw do
match "/#{Rack::Utils.escape("ほげ")}" => lambda { |env|
- path_params = env['action_dispatch.request.path_parameters']
[200, { 'Content-Type' => 'text/plain' }, []]
}, :as => :unicode_path
end
diff --git a/actionpack/test/template/record_tag_helper_test.rb b/actionpack/test/template/record_tag_helper_test.rb
index ec777d15c4..80d6f130ed 100644
--- a/actionpack/test/template/record_tag_helper_test.rb
+++ b/actionpack/test/template/record_tag_helper_test.rb
@@ -1,15 +1,15 @@
require 'abstract_unit'
require 'controller/fake_models'
-class Post
+class RecordTagPost
extend ActiveModel::Naming
include ActiveModel::Conversion
- attr_writer :id, :body
+ attr_writer :id, :body, :persisted
def initialize
@id = nil
@body = nil
- super
+ @persisted = false
end
def id
@@ -17,8 +17,11 @@ class Post
end
def body
- super || @body || "What a wonderful world!"
+ @body || "What a wonderful world!"
end
+
+ def persisted?; @persisted end
+
end
class RecordTagHelperTest < ActionView::TestCase
@@ -28,30 +31,30 @@ class RecordTagHelperTest < ActionView::TestCase
def setup
super
- @post = Post.new
+ @post = RecordTagPost.new
@post.persisted = true
end
def test_content_tag_for
- expected = %(<li class="post bar" id="post_45"></li>)
+ expected = %(<li class="record_tag_post bar" id="record_tag_post_45"></li>)
actual = content_tag_for(:li, @post, :class => 'bar') { }
assert_dom_equal expected, actual
end
def test_content_tag_for_prefix
- expected = %(<ul class="archived_post" id="archived_post_45"></ul>)
+ expected = %(<ul class="archived_record_tag_post" id="archived_record_tag_post_45"></ul>)
actual = content_tag_for(:ul, @post, :archived) { }
assert_dom_equal expected, actual
end
def test_content_tag_for_with_extra_html_tags
- expected = %(<tr class="post bar" id="post_45" style='background-color: #f0f0f0'></tr>)
+ expected = %(<tr class="record_tag_post bar" id="record_tag_post_45" style='background-color: #f0f0f0'></tr>)
actual = content_tag_for(:tr, @post, {:class => "bar", :style => "background-color: #f0f0f0"}) { }
assert_dom_equal expected, actual
end
def test_block_not_in_erb_multiple_calls
- expected = %(<div class="post bar" id="post_45">#{@post.body}</div>)
+ expected = %(<div class="record_tag_post bar" id="record_tag_post_45">#{@post.body}</div>)
actual = div_for(@post, :class => "bar") { @post.body }
assert_dom_equal expected, actual
actual = div_for(@post, :class => "bar") { @post.body }
@@ -59,29 +62,29 @@ class RecordTagHelperTest < ActionView::TestCase
end
def test_block_works_with_content_tag_for_in_erb
- expected = %(<tr class="post" id="post_45">#{@post.body}</tr>)
+ expected = %(<tr class="record_tag_post" id="record_tag_post_45">#{@post.body}</tr>)
actual = render_erb("<%= content_tag_for(:tr, @post) do %><%= @post.body %><% end %>")
assert_dom_equal expected, actual
end
def test_div_for_in_erb
- expected = %(<div class="post bar" id="post_45">#{@post.body}</div>)
+ expected = %(<div class="record_tag_post bar" id="record_tag_post_45">#{@post.body}</div>)
actual = render_erb("<%= div_for(@post, :class => 'bar') do %><%= @post.body %><% end %>")
assert_dom_equal expected, actual
end
def test_content_tag_for_collection
- post_1 = Post.new.tap { |post| post.id = 101; post.body = "Hello!"; post.persisted = true }
- post_2 = Post.new.tap { |post| post.id = 102; post.body = "World!"; post.persisted = true }
- expected = %(<li class="post" id="post_101">Hello!</li>\n<li class="post" id="post_102">World!</li>)
+ post_1 = RecordTagPost.new.tap { |post| post.id = 101; post.body = "Hello!"; post.persisted = true }
+ post_2 = RecordTagPost.new.tap { |post| post.id = 102; post.body = "World!"; post.persisted = true }
+ expected = %(<li class="record_tag_post" id="record_tag_post_101">Hello!</li>\n<li class="record_tag_post" id="record_tag_post_102">World!</li>)
actual = content_tag_for(:li, [post_1, post_2]) { |post| concat post.body }
assert_dom_equal expected, actual
end
def test_div_for_collection
- post_1 = Post.new.tap { |post| post.id = 101; post.body = "Hello!"; post.persisted = true }
- post_2 = Post.new.tap { |post| post.id = 102; post.body = "World!"; post.persisted = true }
- expected = %(<div class="post" id="post_101">Hello!</div>\n<div class="post" id="post_102">World!</div>)
+ post_1 = RecordTagPost.new.tap { |post| post.id = 101; post.body = "Hello!"; post.persisted = true }
+ post_2 = RecordTagPost.new.tap { |post| post.id = 102; post.body = "World!"; post.persisted = true }
+ expected = %(<div class="record_tag_post" id="record_tag_post_101">Hello!</div>\n<div class="record_tag_post" id="record_tag_post_102">World!</div>)
actual = div_for([post_1, post_2]) { |post| concat post.body }
assert_dom_equal expected, actual
end
@@ -92,8 +95,8 @@ class RecordTagHelperTest < ActionView::TestCase
end
def test_content_tag_for_collection_is_html_safe
- post_1 = Post.new.tap { |post| post.id = 101; post.body = "Hello!"; post.persisted = true }
- post_2 = Post.new.tap { |post| post.id = 102; post.body = "World!"; post.persisted = true }
+ post_1 = RecordTagPost.new.tap { |post| post.id = 101; post.body = "Hello!"; post.persisted = true }
+ post_2 = RecordTagPost.new.tap { |post| post.id = 102; post.body = "World!"; post.persisted = true }
result = content_tag_for(:li, [post_1, post_2]) { |post| concat post.body }
assert result.html_safe?
end
diff --git a/activerecord/lib/active_record/counter_cache.rb b/activerecord/lib/active_record/counter_cache.rb
index c9c46b8d4f..ee0b0c7fab 100644
--- a/activerecord/lib/active_record/counter_cache.rb
+++ b/activerecord/lib/active_record/counter_cache.rb
@@ -19,7 +19,7 @@ module ActiveRecord
counters.each do |association|
has_many_association = reflect_on_association(association.to_sym)
- expected_name = if has_many_association.options[:as]
+ if has_many_association.options[:as]
has_many_association.options[:as].to_s.classify
else
self.name
diff --git a/activesupport/test/core_ext/range_ext_test.rb b/activesupport/test/core_ext/range_ext_test.rb
index f9fb4f833a..360c97031c 100644
--- a/activesupport/test/core_ext/range_ext_test.rb
+++ b/activesupport/test/core_ext/range_ext_test.rb
@@ -54,7 +54,7 @@ class RangeTest < Test::Unit::TestCase
end
def test_should_include_identical_exclusive_with_floats
- assert (1.0...10.0).include?(1.0...10.0)
+ assert((1.0...10.0).include?(1.0...10.0))
end
def test_blockless_step