diff options
author | Sergey Nartimov + José Valim <jose.valim@gmail.com> | 2012-03-02 15:01:20 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2012-03-02 15:01:20 +0100 |
commit | cd5dabab95924dfaf3af8c429454f1a46d9665c1 (patch) | |
tree | 41200dffbf8bf0ec0d6ff2068c19566771eef541 /actionpack/test | |
parent | d7014bc7eaa62c36f045a503cdad64e4ebbc2687 (diff) | |
download | rails-cd5dabab95924dfaf3af8c429454f1a46d9665c1.tar.gz rails-cd5dabab95924dfaf3af8c429454f1a46d9665c1.tar.bz2 rails-cd5dabab95924dfaf3af8c429454f1a46d9665c1.zip |
Optimize url helpers.
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/base_test.rb | 8 | ||||
-rw-r--r-- | actionpack/test/controller/routing_test.rb | 6 | ||||
-rw-r--r-- | actionpack/test/template/sprockets_helper_with_routes_test.rb | 4 |
3 files changed, 9 insertions, 9 deletions
diff --git a/actionpack/test/controller/base_test.rb b/actionpack/test/controller/base_test.rb index 791edb9069..7d0609751f 100644 --- a/actionpack/test/controller/base_test.rb +++ b/actionpack/test/controller/base_test.rb @@ -56,7 +56,7 @@ class UrlOptionsController < ActionController::Base end def url_options - super.merge(:host => 'www.override.com', :action => 'new', :locale => 'en') + super.merge(:host => 'www.override.com') end end @@ -183,9 +183,9 @@ class UrlOptionsTest < ActionController::TestCase 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') + assert_equal 'http://www.override.com/from_view', @response.body + assert_equal 'http://www.override.com/from_view', @controller.send(:from_view_url) + assert_equal 'http://www.override.com/default_url_options/index', @controller.url_for(:controller => 'default_url_options') end end diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index 843ae1a813..2a7c1f86c6 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -59,11 +59,11 @@ end class MockController def self.build(helpers) Class.new do - def url_for(options) + def url_options + options = super options[:protocol] ||= "http" options[:host] ||= "test.host" - - super(options) + options end include helpers diff --git a/actionpack/test/template/sprockets_helper_with_routes_test.rb b/actionpack/test/template/sprockets_helper_with_routes_test.rb index bcbd81a7dd..89b9940eb7 100644 --- a/actionpack/test/template/sprockets_helper_with_routes_test.rb +++ b/actionpack/test/template/sprockets_helper_with_routes_test.rb @@ -17,7 +17,7 @@ class SprocketsHelperWithRoutesTest < ActionView::TestCase def setup super - @controller = BasicController.new + @controller = BasicController.new @assets = Sprockets::Environment.new @assets.append_path(FIXTURES.join("sprockets/app/javascripts")) @@ -34,7 +34,7 @@ class SprocketsHelperWithRoutesTest < ActionView::TestCase test "namespace conflicts on a named route called asset_path" do # Testing this for sanity - asset_path is now a named route! - assert_match asset_path('test_asset'), '/assets/test_asset' + assert_equal asset_path('test_asset'), '/assets/test_asset' assert_match %r{/assets/logo-[0-9a-f]+.png}, path_to_asset("logo.png") |