Methods
- S
- T
Instance Public methods
setup()
Link
test_default_url_options_are_used_in_non_positional_parameters()
Link
# File actionpack/test/controller/base_test.rb, line 335 def test_default_url_options_are_used_in_non_positional_parameters with_routing do |set| set.draw do scope("/:locale") do resources :descriptions end 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") end end
test_default_url_options_override()
Link
# File actionpack/test/controller/base_test.rb, line 320 def test_default_url_options_override with_routing do |set| set.draw do match 'from_view', :to => 'default_url_options#from_view', :as => :from_view match ':controller/:action' end 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