class UrlOptionsTest
Public Instance Methods
setup()
click to toggle source
Calls superclass method
# File actionpack/test/controller/base_test.rb, line 181 def setup super @request.host = "www.example.com" end
test_url_for_query_params_included()
click to toggle source
# File actionpack/test/controller/base_test.rb, line 186 def test_url_for_query_params_included rs = ActionDispatch::Routing::RouteSet.new rs.draw do get "home" => "pages#home" end options = { action: "home", controller: "pages", only_path: true, params: { "token" => "secret" } } assert_equal "/home?token=secret", rs.url_for(options) end
test_url_helpers_does_not_become_actions()
click to toggle source
# File actionpack/test/controller/base_test.rb, line 220 def test_url_helpers_does_not_become_actions with_routing do |set| set.draw do get "account/overview" end assert_not_includes @controller.class.action_methods, "account_overview_path" end end
test_url_options_override()
click to toggle source
# File actionpack/test/controller/base_test.rb, line 202 def test_url_options_override with_routing do |set| set.draw do get "from_view", to: "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", @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