aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlhuda <carlhuda@engineyard.com>2010-02-26 15:34:12 -0800
committerCarlhuda <carlhuda@engineyard.com>2010-02-26 15:34:12 -0800
commit47fe14bfcc553acfd4c44434636529f25054a751 (patch)
treee7235a4cf7bf5cabf7ee286c143048f4fa15c0d5
parentbae691f61ab8cf4a59adaee6406855e11d009c74 (diff)
downloadrails-47fe14bfcc553acfd4c44434636529f25054a751.tar.gz
rails-47fe14bfcc553acfd4c44434636529f25054a751.tar.bz2
rails-47fe14bfcc553acfd4c44434636529f25054a751.zip
Silence test deprecation warnings
-rw-r--r--actionpack/test/controller/base_test.rb71
-rw-r--r--actionpack/test/template/url_helper_test.rb2
2 files changed, 56 insertions, 17 deletions
diff --git a/actionpack/test/controller/base_test.rb b/actionpack/test/controller/base_test.rb
index 207dc63d57..ade9a7fcba 100644
--- a/actionpack/test/controller/base_test.rb
+++ b/actionpack/test/controller/base_test.rb
@@ -66,6 +66,16 @@ class DefaultUrlOptionsController < ActionController::Base
end
end
+class UrlOptionsController < ActionController::Base
+ def from_view
+ render :inline => "<%= #{params[:route]} %>"
+ end
+
+ def url_options
+ super.merge(:host => 'www.override.com', :action => 'new', :locale => 'en')
+ end
+end
+
class ControllerClassTests < ActiveSupport::TestCase
def test_controller_path
assert_equal 'empty', EmptyController.controller_path
@@ -162,8 +172,8 @@ class PerformActionTest < ActionController::TestCase
end
end
-class DefaultUrlOptionsTest < ActionController::TestCase
- tests DefaultUrlOptionsController
+class UrlOptionsTest < ActionController::TestCase
+ tests UrlOptionsController
def setup
super
@@ -174,7 +184,7 @@ class DefaultUrlOptionsTest < ActionController::TestCase
def test_default_url_options_are_used_if_set
with_routing do |set|
set.draw do |map|
- match 'from_view', :to => 'default_url_options#from_view', :as => :from_view
+ match 'from_view', :to => 'url_options#from_view', :as => :from_view
match ':controller/:action'
end
@@ -184,6 +194,33 @@ class DefaultUrlOptionsTest < ActionController::TestCase
assert_equal 'http://www.override.com/from_view?locale=en', @controller.send(:from_view_url)
assert_equal 'http://www.override.com/default_url_options/new?locale=en', @controller.url_for(:controller => 'default_url_options')
end
+ end
+end
+
+class DefaultUrlOptionsTest < ActionController::TestCase
+ tests DefaultUrlOptionsController
+
+ def setup
+ super
+ @request.host = 'www.example.com'
+ rescue_action_in_public!
+ end
+
+ def test_default_url_options_are_used_if_set
+ with_routing do |set|
+ set.draw do |map|
+ match 'from_view', :to => 'default_url_options#from_view', :as => :from_view
+ match ':controller/:action'
+ end
+
+ assert_deprecated do
+ get :from_view, :route => "from_view_url"
+
+ assert_equal 'http://www.override.com/from_view?locale=en', @response.body
+ assert_equal 'http://www.override.com/from_view?locale=en', @controller.send(:from_view_url)
+ assert_equal 'http://www.override.com/default_url_options/new?locale=en', @controller.url_for(:controller => 'default_url_options')
+ end
+ end
end
def test_default_url_options_are_used_in_non_positional_parameters
@@ -195,19 +232,21 @@ class DefaultUrlOptionsTest < ActionController::TestCase
match ':controller/:action'
end
- get :from_view, :route => "description_path(1)"
-
- assert_equal '/en/descriptions/1', @response.body
- assert_equal '/en/descriptions', @controller.send(:descriptions_path)
- assert_equal '/pl/descriptions', @controller.send(:descriptions_path, "pl")
- assert_equal '/pl/descriptions', @controller.send(:descriptions_path, :locale => "pl")
- assert_equal '/pl/descriptions.xml', @controller.send(:descriptions_path, "pl", "xml")
- assert_equal '/en/descriptions.xml', @controller.send(:descriptions_path, :format => "xml")
- assert_equal '/en/descriptions/1', @controller.send(:description_path, 1)
- assert_equal '/pl/descriptions/1', @controller.send(:description_path, "pl", 1)
- assert_equal '/pl/descriptions/1', @controller.send(:description_path, 1, :locale => "pl")
- assert_equal '/pl/descriptions/1.xml', @controller.send(:description_path, "pl", 1, "xml")
- assert_equal '/en/descriptions/1.xml', @controller.send(:description_path, 1, :format => "xml")
+ assert_deprecated do
+ get :from_view, :route => "description_path(1)"
+
+ assert_equal '/en/descriptions/1', @response.body
+ assert_equal '/en/descriptions', @controller.send(:descriptions_path)
+ assert_equal '/pl/descriptions', @controller.send(:descriptions_path, "pl")
+ assert_equal '/pl/descriptions', @controller.send(:descriptions_path, :locale => "pl")
+ assert_equal '/pl/descriptions.xml', @controller.send(:descriptions_path, "pl", "xml")
+ assert_equal '/en/descriptions.xml', @controller.send(:descriptions_path, :format => "xml")
+ assert_equal '/en/descriptions/1', @controller.send(:description_path, 1)
+ assert_equal '/pl/descriptions/1', @controller.send(:description_path, "pl", 1)
+ assert_equal '/pl/descriptions/1', @controller.send(:description_path, 1, :locale => "pl")
+ assert_equal '/pl/descriptions/1.xml', @controller.send(:description_path, "pl", 1, "xml")
+ assert_equal '/en/descriptions/1.xml', @controller.send(:description_path, 1, :format => "xml")
+ end
end
end
diff --git a/actionpack/test/template/url_helper_test.rb b/actionpack/test/template/url_helper_test.rb
index c917ca9d2b..b047466aaf 100644
--- a/actionpack/test/template/url_helper_test.rb
+++ b/actionpack/test/template/url_helper_test.rb
@@ -426,7 +426,7 @@ class UrlHelperControllerTest < ActionController::TestCase
end
with_url_helper_routing do
- get :show_named_route, :kind => 'url'
+ assert_deprecated { get :show_named_route, :kind => 'url' }
assert_equal 'http://testtwo.host/url_helper_controller_test/url_helper/show_named_route', @response.body
end
end