提交 249622e7 编写于 作者: S Sharang Dashputre

url -> URL where apt inside actionpack/

上级 e0a9e025
......@@ -333,7 +333,7 @@ def define_url_helper(mod, route, name, opts, route_key, url_strategy)
end
end
# strategy for building urls to send to the client
# strategy for building URLs to send to the client
PATH = ->(options) { ActionDispatch::Http::URL.path_for(options) }
UNKNOWN = ->(options) { ActionDispatch::Http::URL.url_for(options) }
......
......@@ -282,7 +282,7 @@ def test_assert_redirect_failure_message_with_protocol_relative_url
assert_no_match(
/#{request.protocol}#{request.host}\/\/www.rubyonrails.org/,
ex.message,
"protocol relative url was incorrectly normalized"
"protocol relative URL was incorrectly normalized"
)
end
......
......@@ -808,17 +808,17 @@ def app
end
end
test "session uses default url options from routes" do
test "session uses default URL options from routes" do
assert_equal "http://foo.com/foo", foos_url
end
test "current host overrides default url options from routes" do
test "current host overrides default URL options from routes" do
get "/foo"
assert_response :success
assert_equal "http://www.example.com/foo", foos_url
end
test "controller can override default url options from request" do
test "controller can override default URL options from request" do
get "/bar"
assert_response :success
assert_equal "http://bar.com/foo", foos_url
......
......@@ -115,14 +115,14 @@ class RendererTest < ActiveSupport::TestCase
assert_equal "true", content
end
test "return valid asset url with defaults" do
test "return valid asset URL with defaults" do
renderer = ApplicationController.renderer
content = renderer.render inline: "<%= asset_url 'asset.jpg' %>"
assert_equal "http://example.org/asset.jpg", content
end
test "return valid asset url when https is true" do
test "return valid asset URL when https is true" do
renderer = ApplicationController.renderer.new https: true
content = renderer.render inline: "<%= asset_url 'asset.jpg' %>"
......
......@@ -952,7 +952,7 @@ def test_redirect_url_only_cares_about_location_header
get :create
assert_response :created
# Redirect url doesn't care that it wasn't a :redirect response.
# Redirect URL doesn't care that it wasn't a :redirect response.
assert_equal "/resource", @response.redirect_url
assert_equal @response.redirect_url, redirect_to_url
......
......@@ -341,7 +341,7 @@ def call(env)
assert_match %r{NameError}, body
end
test "named urls missing keys raise 500 level error" do
test "named URLs missing keys raise 500 level error" do
@app = DevelopmentApp
get "/missing_keys", headers: { "action_dispatch.show_exceptions" => true }
......
......@@ -151,17 +151,17 @@ def setup
include BlogEngine.routes.mounted_helpers
# Inside Engine
test "[ENGINE] generating engine's url use SCRIPT_NAME from request" do
test "[ENGINE] generating engine's URL use SCRIPT_NAME from request" do
get "/pure-awesomeness/blog/posts/1"
assert_equal "/pure-awesomeness/blog/posts/1", response.body
end
test "[ENGINE] generating application's url never uses SCRIPT_NAME from request" do
test "[ENGINE] generating application's URL never uses SCRIPT_NAME from request" do
get "/pure-awesomeness/blog/url_to_application"
assert_equal "/generate", response.body
end
test "[ENGINE] generating engine's url with polymorphic path" do
test "[ENGINE] generating engine's URL with polymorphic path" do
get "/pure-awesomeness/blog/polymorphic_path_for_engine"
assert_equal "/pure-awesomeness/blog/posts/1", response.body
end
......@@ -243,7 +243,7 @@ def setup
assert_equal "/something/awesome/blog/posts/1", response.body
end
test "[APP] generating engine's url with polymorphic path" do
test "[APP] generating engine's URL with polymorphic path" do
get "/polymorphic_path_for_engine"
assert_equal "/awesome/blog/posts/1", response.body
end
......@@ -253,7 +253,7 @@ def setup
assert_equal "/posts/1", response.body
end
test "[APP] generating engine's url with url_for(@post)" do
test "[APP] generating engine's URL with url_for(@post)" do
get "/polymorphic_with_url_for"
assert_equal "http://www.example.com/awesome/blog/posts/1", response.body
end
......
......@@ -411,7 +411,7 @@ class RequestPath < BaseRequestTest
assert_equal "/foo?bar", path
end
test "original_url returns url built using ORIGINAL_FULLPATH" do
test "original_url returns URL built using ORIGINAL_FULLPATH" do
request = stub_request("ORIGINAL_FULLPATH" => "/foo?bar",
"HTTP_HOST" => "example.org",
"rack.url_scheme" => "http")
......
......@@ -29,7 +29,7 @@ def call(env)
assert_not empty?
end
test "url helpers are added when route is added" do
test "URL helpers are added when route is added" do
draw do
get "foo", to: SimpleApp.new("foo#index")
end
......@@ -48,7 +48,7 @@ def call(env)
assert_equal "/bar", url_helpers.bar_path
end
test "url helpers are updated when route is updated" do
test "URL helpers are updated when route is updated" do
draw do
get "bar", to: SimpleApp.new("bar#index"), as: :bar
end
......@@ -62,7 +62,7 @@ def call(env)
assert_equal "/baz", url_helpers.bar_path
end
test "url helpers are removed when route is removed" do
test "URL helpers are removed when route is removed" do
draw do
get "foo", to: SimpleApp.new("foo#index")
get "bar", to: SimpleApp.new("bar#index")
......
......@@ -4392,7 +4392,7 @@ def app; APP end
include Routes.url_helpers
test "url helpers do not ignore nil parameters when using non-optimized routes" do
test "URL helpers do not ignore nil parameters when using non-optimized routes" do
Routes.stub :optimize_routes_generation?, false do
get "/categories/1"
assert_response :success
......@@ -4764,7 +4764,7 @@ def app; APP end
include Routes.url_helpers
test "url helpers raise a 'missing keys' error for a nil param with optimized helpers" do
test "URL helpers raise a 'missing keys' error for a nil param with optimized helpers" do
url, missing = { action: "show", controller: "products", id: nil }, [:id]
message = "No route matches #{url.inspect}, missing required keys: #{missing.inspect}"
......@@ -4772,7 +4772,7 @@ def app; APP end
assert_equal message, error.message
end
test "url helpers raise a 'constraint failure' error for a nil param with non-optimized helpers" do
test "URL helpers raise a 'constraint failure' error for a nil param with non-optimized helpers" do
url, missing = { action: "show", controller: "products", id: nil }, [:id]
message = "No route matches #{url.inspect}, possible unmatched constraints: #{missing.inspect}"
......@@ -4780,15 +4780,15 @@ def app; APP end
assert_equal message, error.message
end
test "url helpers raise message with mixed parameters when generation fails" do
test "URL helpers raise message with mixed parameters when generation fails" do
url, missing = { action: "show", controller: "products", id: nil, "id" => "url-tested" }, [:id]
message = "No route matches #{url.inspect}, possible unmatched constraints: #{missing.inspect}"
# Optimized url helper
# Optimized URL helper
error = assert_raises(ActionController::UrlGenerationError) { product_path(nil, "id" => "url-tested") }
assert_equal message, error.message
# Non-optimized url helper
# Non-optimized URL helper
error = assert_raises(ActionController::UrlGenerationError, message) { product_path(id: nil, "id" => "url-tested") }
assert_equal message, error.message
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册