Methods
S
T
Instance Public methods
setup()
# File actionpack/test/controller/base_test.rb, line 246
def setup
  super
  @request.host = 'www.example.com'
end
test_default_url_options_are_used_in_non_positional_parameters()
# File actionpack/test/controller/base_test.rb, line 266
def test_default_url_options_are_used_in_non_positional_parameters
  with_routing do |set|
    set.draw do
      scope("/:locale") do
        resources :descriptions
      end
      get ':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()
# File actionpack/test/controller/base_test.rb, line 251
def test_default_url_options_override
  with_routing do |set|
    set.draw do
      get 'from_view', :to => 'default_url_options#from_view', :as => :from_view
      get ':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