Methods
S
T
Instance Public methods
setup()
# File actionpack/test/controller/base_test.rb, line 206
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 229
def test_default_url_options_are_used_in_non_positional_parameters
  with_routing do |set|
    set.draw do
      scope("/:locale") do
        resources :descriptions
      end

      ActiveSupport::Deprecation.silence do
        get ':controller/:action'
      end
    end

    get :from_view, params: { 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 211
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

      ActiveSupport::Deprecation.silence do
        get ':controller/:action'
      end
    end

    get :from_view, params: { 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