mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
url -> URL where apt except inside actionpack/
This commit is contained in:
parent
e0a9e0259c
commit
771973c13d
26 changed files with 41 additions and 41 deletions
|
@ -176,7 +176,7 @@ module ActionCable
|
||||||
#
|
#
|
||||||
# Accepts request path as the first argument and the following request options:
|
# Accepts request path as the first argument and the following request options:
|
||||||
#
|
#
|
||||||
# - params – url parameters (Hash)
|
# - params – URL parameters (Hash)
|
||||||
# - headers – request headers (Hash)
|
# - headers – request headers (Hash)
|
||||||
# - session – session data (Hash)
|
# - session – session data (Hash)
|
||||||
# - env – additional Rack env configuration (Hash)
|
# - env – additional Rack env configuration (Hash)
|
||||||
|
|
|
@ -24,7 +24,7 @@ module ActionView
|
||||||
|
|
||||||
mattr_accessor :default_enforce_utf8, default: true
|
mattr_accessor :default_enforce_utf8, default: true
|
||||||
|
|
||||||
# Starts a form tag that points the action to a url configured with <tt>url_for_options</tt> just like
|
# Starts a form tag that points the action to a URL configured with <tt>url_for_options</tt> just like
|
||||||
# ActionController::Base#url_for. The method for the form defaults to POST.
|
# ActionController::Base#url_for. The method for the form defaults to POST.
|
||||||
#
|
#
|
||||||
# ==== Options
|
# ==== Options
|
||||||
|
|
|
@ -553,7 +553,7 @@ module ActionView
|
||||||
url_string = URI.parser.unescape(url_for(options)).force_encoding(Encoding::BINARY)
|
url_string = URI.parser.unescape(url_for(options)).force_encoding(Encoding::BINARY)
|
||||||
|
|
||||||
# We ignore any extra parameters in the request_uri if the
|
# We ignore any extra parameters in the request_uri if the
|
||||||
# submitted url doesn't have any either. This lets the function
|
# submitted URL doesn't have any either. This lets the function
|
||||||
# work with things like ?order=asc
|
# work with things like ?order=asc
|
||||||
# the behaviour can be disabled with check_parameters: true
|
# the behaviour can be disabled with check_parameters: true
|
||||||
request_uri = url_string.index("?") || check_parameters ? request.fullpath : request.path
|
request_uri = url_string.index("?") || check_parameters ? request.fullpath : request.path
|
||||||
|
|
|
@ -54,7 +54,7 @@ class JavaScriptHelperTest < ActionView::TestCase
|
||||||
assert_equal "foo", output_buffer, "javascript_tag without a block should not concat to output_buffer"
|
assert_equal "foo", output_buffer, "javascript_tag without a block should not concat to output_buffer"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Setting the :extname option will control what extension (if any) is appended to the url for assets
|
# Setting the :extname option will control what extension (if any) is appended to the URL for assets
|
||||||
def test_javascript_include_tag
|
def test_javascript_include_tag
|
||||||
assert_dom_equal "<script src='/foo.js'></script>", javascript_include_tag("/foo")
|
assert_dom_equal "<script src='/foo.js'></script>", javascript_include_tag("/foo")
|
||||||
assert_dom_equal "<script src='/foo'></script>", javascript_include_tag("/foo", extname: false)
|
assert_dom_equal "<script src='/foo'></script>", javascript_include_tag("/foo", extname: false)
|
||||||
|
|
|
@ -53,7 +53,7 @@ asyncTest('form default method is GET', 1, function() {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
asyncTest('form url is picked up from "action"', 1, function() {
|
asyncTest('form URL is picked up from "action"', 1, function() {
|
||||||
buildForm({ method: 'post' })
|
buildForm({ method: 'post' })
|
||||||
|
|
||||||
submit(function(e, data, status, xhr) {
|
submit(function(e, data, status, xhr) {
|
||||||
|
@ -61,7 +61,7 @@ asyncTest('form url is picked up from "action"', 1, function() {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
asyncTest('form url is read from "action" not "href"', 1, function() {
|
asyncTest('form URL is read from "action" not "href"', 1, function() {
|
||||||
buildForm({ method: 'post', href: '/echo2' })
|
buildForm({ method: 'post', href: '/echo2' })
|
||||||
|
|
||||||
submit(function(e, data, status, xhr) {
|
submit(function(e, data, status, xhr) {
|
||||||
|
@ -69,7 +69,7 @@ asyncTest('form url is read from "action" not "href"', 1, function() {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
asyncTest('form url is read from submit button "formaction" if submit is triggered by that button', 1, function() {
|
asyncTest('form URL is read from submit button "formaction" if submit is triggered by that button', 1, function() {
|
||||||
var submitButton = $('<input type="submit" formaction="/echo">')
|
var submitButton = $('<input type="submit" formaction="/echo">')
|
||||||
buildForm({ method: 'post', href: '/echo2' })
|
buildForm({ method: 'post', href: '/echo2' })
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,7 @@ asyncTest('clicking on a link with both query string in href and data-params', 4
|
||||||
App.assertGetRequest(data)
|
App.assertGetRequest(data)
|
||||||
equal(data.params.data1, 'value1', 'ajax arguments should have key data1 with right value')
|
equal(data.params.data1, 'value1', 'ajax arguments should have key data1 with right value')
|
||||||
equal(data.params.data2, 'value2', 'ajax arguments should have key data2 with right value')
|
equal(data.params.data2, 'value2', 'ajax arguments should have key data2 with right value')
|
||||||
equal(data.params.data3, 'value3', 'query string in url should be passed to server with right value')
|
equal(data.params.data3, 'value3', 'query string in URL should be passed to server with right value')
|
||||||
})
|
})
|
||||||
.bindNative('ajax:complete', function() { start() })
|
.bindNative('ajax:complete', function() { start() })
|
||||||
.triggerNative('click')
|
.triggerNative('click')
|
||||||
|
@ -135,7 +135,7 @@ asyncTest('clicking on a link with both query string in href and data-params wit
|
||||||
App.assertPostRequest(data)
|
App.assertPostRequest(data)
|
||||||
equal(data.params.data1, 'value1', 'ajax arguments should have key data1 with right value')
|
equal(data.params.data1, 'value1', 'ajax arguments should have key data1 with right value')
|
||||||
equal(data.params.data2, 'value2', 'ajax arguments should have key data2 with right value')
|
equal(data.params.data2, 'value2', 'ajax arguments should have key data2 with right value')
|
||||||
equal(data.params.data3, 'value3', 'query string in url should be passed to server with right value')
|
equal(data.params.data3, 'value3', 'query string in URL should be passed to server with right value')
|
||||||
})
|
})
|
||||||
.bindNative('ajax:complete', function() { start() })
|
.bindNative('ajax:complete', function() { start() })
|
||||||
.triggerNative('click')
|
.triggerNative('click')
|
||||||
|
|
|
@ -18,7 +18,7 @@ App.assertPostRequest = function(requestEnv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
App.assertRequestPath = function(requestEnv, path) {
|
App.assertRequestPath = function(requestEnv, path) {
|
||||||
equal(requestEnv['PATH_INFO'], path, 'request should be sent to right url')
|
equal(requestEnv['PATH_INFO'], path, 'request should be sent to right URL')
|
||||||
}
|
}
|
||||||
|
|
||||||
App.getVal = function(el) {
|
App.getVal = function(el) {
|
||||||
|
|
|
@ -454,7 +454,7 @@
|
||||||
|
|
||||||
*Sean Griffin*
|
*Sean Griffin*
|
||||||
|
|
||||||
* Add support for hash and url configs in database hash of `ActiveRecord::Base.connected_to`.
|
* Add support for hash and URL configs in database hash of `ActiveRecord::Base.connected_to`.
|
||||||
|
|
||||||
````
|
````
|
||||||
User.connected_to(database: { writing: "postgres://foo" }) do
|
User.connected_to(database: { writing: "postgres://foo" }) do
|
||||||
|
|
|
@ -7,7 +7,7 @@ require "active_record/database_configurations/url_config"
|
||||||
module ActiveRecord
|
module ActiveRecord
|
||||||
# ActiveRecord::DatabaseConfigurations returns an array of DatabaseConfig
|
# ActiveRecord::DatabaseConfigurations returns an array of DatabaseConfig
|
||||||
# objects (either a HashConfig or UrlConfig) that are constructed from the
|
# objects (either a HashConfig or UrlConfig) that are constructed from the
|
||||||
# application's database configuration hash or url string.
|
# application's database configuration hash or URL string.
|
||||||
class DatabaseConfigurations
|
class DatabaseConfigurations
|
||||||
attr_reader :configurations
|
attr_reader :configurations
|
||||||
delegate :any?, to: :configurations
|
delegate :any?, to: :configurations
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# Serves files stored with the disk service in the same way that the cloud services do.
|
# Serves files stored with the disk service in the same way that the cloud services do.
|
||||||
# This means using expiring, signed URLs that are meant for immediate access, not permanent linking.
|
# This means using expiring, signed URLs that are meant for immediate access, not permanent linking.
|
||||||
# Always go through the BlobsController, or your own authenticated controller, rather than directly
|
# Always go through the BlobsController, or your own authenticated controller, rather than directly
|
||||||
# to the service url.
|
# to the service URL.
|
||||||
class ActiveStorage::DiskController < ActiveStorage::BaseController
|
class ActiveStorage::DiskController < ActiveStorage::BaseController
|
||||||
skip_forgery_protection
|
skip_forgery_protection
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ class ActiveStorage::BlobTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
test "urls expiring in 5 minutes" do
|
test "URLs expiring in 5 minutes" do
|
||||||
blob = create_blob
|
blob = create_blob
|
||||||
|
|
||||||
freeze_time do
|
freeze_time do
|
||||||
|
@ -123,7 +123,7 @@ class ActiveStorage::BlobTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
test "urls force content_type to binary and attachment as content disposition for content types served as binary" do
|
test "URLs force content_type to binary and attachment as content disposition for content types served as binary" do
|
||||||
blob = create_blob(content_type: "text/html")
|
blob = create_blob(content_type: "text/html")
|
||||||
|
|
||||||
freeze_time do
|
freeze_time do
|
||||||
|
@ -132,7 +132,7 @@ class ActiveStorage::BlobTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
test "urls force attachment as content disposition when the content type is not allowed inline" do
|
test "URLs force attachment as content disposition when the content type is not allowed inline" do
|
||||||
blob = create_blob(content_type: "application/zip")
|
blob = create_blob(content_type: "application/zip")
|
||||||
|
|
||||||
freeze_time do
|
freeze_time do
|
||||||
|
@ -141,7 +141,7 @@ class ActiveStorage::BlobTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
test "urls allow for custom filename" do
|
test "URLs allow for custom filename" do
|
||||||
blob = create_blob(filename: "original.txt")
|
blob = create_blob(filename: "original.txt")
|
||||||
new_filename = ActiveStorage::Filename.new("new.txt")
|
new_filename = ActiveStorage::Filename.new("new.txt")
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ class ActiveStorage::BlobTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
test "urls allow for custom options" do
|
test "URLs allow for custom options" do
|
||||||
blob = create_blob(filename: "original.txt")
|
blob = create_blob(filename: "original.txt")
|
||||||
|
|
||||||
arguments = [
|
arguments = [
|
||||||
|
|
|
@ -7,7 +7,7 @@ class ActiveStorage::Service::DiskServiceTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
include ActiveStorage::Service::SharedServiceTests
|
include ActiveStorage::Service::SharedServiceTests
|
||||||
|
|
||||||
test "url generation" do
|
test "URL generation" do
|
||||||
assert_match(/^https:\/\/example.com\/rails\/active_storage\/disk\/.*\/avatar\.png\?content_type=image%2Fpng&disposition=inline/,
|
assert_match(/^https:\/\/example.com\/rails\/active_storage\/disk\/.*\/avatar\.png\?content_type=image%2Fpng&disposition=inline/,
|
||||||
@service.url(@key, expires_in: 5.minutes, disposition: :inline, filename: ActiveStorage::Filename.new("avatar.png"), content_type: "image/png"))
|
@service.url(@key, expires_in: 5.minutes, disposition: :inline, filename: ActiveStorage::Filename.new("avatar.png"), content_type: "image/png"))
|
||||||
end
|
end
|
||||||
|
|
|
@ -37,7 +37,7 @@ class ActiveStorage::ImageTagTest < ActionView::TestCase
|
||||||
assert_raises(ArgumentError) { image_tag(@user.avatar) }
|
assert_raises(ArgumentError) { image_tag(@user.avatar) }
|
||||||
end
|
end
|
||||||
|
|
||||||
test "error when object can't be resolved into url" do
|
test "error when object can't be resolved into URL" do
|
||||||
unresolvable_object = ActionView::Helpers::AssetTagHelper
|
unresolvable_object = ActionView::Helpers::AssetTagHelper
|
||||||
assert_raises(ArgumentError) { image_tag(unresolvable_object) }
|
assert_raises(ArgumentError) { image_tag(unresolvable_object) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -240,7 +240,7 @@ Action Pack
|
||||||
|
|
||||||
* Added `config.action_controller.include_all_helpers`. By default `helper :all` is done in `ActionController::Base`, which includes all the helpers by default. Setting `include_all_helpers` to `false` will result in including only application_helper and the helper corresponding to controller (like foo_helper for foo_controller).
|
* Added `config.action_controller.include_all_helpers`. By default `helper :all` is done in `ActionController::Base`, which includes all the helpers by default. Setting `include_all_helpers` to `false` will result in including only application_helper and the helper corresponding to controller (like foo_helper for foo_controller).
|
||||||
|
|
||||||
* `url_for` and named url helpers now accept `:subdomain` and `:domain` as options.
|
* `url_for` and named URL helpers now accept `:subdomain` and `:domain` as options.
|
||||||
|
|
||||||
* Added `Base.http_basic_authenticate_with` to do simple http basic authentication with a single class method call.
|
* Added `Base.http_basic_authenticate_with` to do simple http basic authentication with a single class method call.
|
||||||
|
|
||||||
|
@ -293,7 +293,7 @@ Action Pack
|
||||||
|
|
||||||
You can restrict it to some actions by using `:only` or `:except`. Please read the docs at [`ActionController::Streaming`](https://api.rubyonrails.org/v3.1.0/classes/ActionController/Streaming.html) for more information.
|
You can restrict it to some actions by using `:only` or `:except`. Please read the docs at [`ActionController::Streaming`](https://api.rubyonrails.org/v3.1.0/classes/ActionController/Streaming.html) for more information.
|
||||||
|
|
||||||
* The redirect route method now also accepts a hash of options which will only change the parts of the url in question, or an object which responds to call, allowing for redirects to be reused.
|
* The redirect route method now also accepts a hash of options which will only change the parts of the URL in question, or an object which responds to call, allowing for redirects to be reused.
|
||||||
|
|
||||||
### Action Dispatch
|
### Action Dispatch
|
||||||
|
|
||||||
|
|
|
@ -573,7 +573,7 @@ web addresses. Thus, you should always use the "_url" variant of named route
|
||||||
helpers.
|
helpers.
|
||||||
|
|
||||||
If you did not configure the `:host` option globally make sure to pass it to the
|
If you did not configure the `:host` option globally make sure to pass it to the
|
||||||
url helper.
|
URL helper.
|
||||||
|
|
||||||
```erb
|
```erb
|
||||||
<%= user_url(@user, host: 'example.com') %>
|
<%= user_url(@user, host: 'example.com') %>
|
||||||
|
|
|
@ -580,7 +580,7 @@ Active Storage
|
||||||
| ------------ | ------------------- |
|
| ------------ | ------------------- |
|
||||||
| `:key` | Secure token |
|
| `:key` | Secure token |
|
||||||
| `:service` | Name of the service |
|
| `:service` | Name of the service |
|
||||||
| `:url` | Generated url |
|
| `:url` | Generated URL |
|
||||||
|
|
||||||
Railties
|
Railties
|
||||||
--------
|
--------
|
||||||
|
|
|
@ -344,7 +344,7 @@ irb(main):001:0>
|
||||||
|
|
||||||
Inside the `rails console` you have access to the `app` and `helper` instances.
|
Inside the `rails console` you have access to the `app` and `helper` instances.
|
||||||
|
|
||||||
With the `app` method you can access url and path helpers, as well as do requests.
|
With the `app` method you can access URL and path helpers, as well as do requests.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
>> app.root_path
|
>> app.root_path
|
||||||
|
|
|
@ -1162,7 +1162,7 @@ Imagine you have a server which mirrors the production environment but is only u
|
||||||
That environment is no different than the default ones, start a server with `rails server -e staging`, a console with `rails console -e staging`, `Rails.env.staging?` works, etc.
|
That environment is no different than the default ones, start a server with `rails server -e staging`, a console with `rails console -e staging`, `Rails.env.staging?` works, etc.
|
||||||
|
|
||||||
|
|
||||||
### Deploy to a subdirectory (relative url root)
|
### Deploy to a subdirectory (relative URL root)
|
||||||
|
|
||||||
By default Rails expects that your application is running at the root
|
By default Rails expects that your application is running at the root
|
||||||
(eg. `/`). This section explains how to run your application inside a directory.
|
(eg. `/`). This section explains how to run your application inside a directory.
|
||||||
|
|
|
@ -248,7 +248,7 @@ There are a few things to note here:
|
||||||
* `@article` is the actual object being edited.
|
* `@article` is the actual object being edited.
|
||||||
* There is a single hash of options. HTML options (except `id` and `class`) are passed in the `:html` hash. Also you can provide a `:namespace` option for your form to ensure uniqueness of id attributes on form elements. The scope attribute will be prefixed with underscore on the generated HTML id.
|
* There is a single hash of options. HTML options (except `id` and `class`) are passed in the `:html` hash. Also you can provide a `:namespace` option for your form to ensure uniqueness of id attributes on form elements. The scope attribute will be prefixed with underscore on the generated HTML id.
|
||||||
* The `form_with` method yields a **form builder** object (the `f` variable).
|
* The `form_with` method yields a **form builder** object (the `f` variable).
|
||||||
* If you wish to direct your form request to a particular url, you would use `form_with url: my_nifty_url_path` instead. To see more in depth options on what `form_with` accepts be sure to [check out the API documentation](https://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-form_with).
|
* If you wish to direct your form request to a particular URL, you would use `form_with url: my_nifty_url_path` instead. To see more in depth options on what `form_with` accepts be sure to [check out the API documentation](https://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-form_with).
|
||||||
* Methods to create form controls are called **on** the form builder object `f`.
|
* Methods to create form controls are called **on** the form builder object `f`.
|
||||||
|
|
||||||
The resulting HTML is:
|
The resulting HTML is:
|
||||||
|
|
|
@ -13,7 +13,7 @@ After reading this guide, you will know:
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
WARNING: This guide assumes a working knowledge of Rack protocol and Rack concepts such as middlewares, url maps, and `Rack::Builder`.
|
WARNING: This guide assumes a working knowledge of Rack protocol and Rack concepts such as middlewares, URL maps, and `Rack::Builder`.
|
||||||
|
|
||||||
Introduction to Rack
|
Introduction to Rack
|
||||||
--------------------
|
--------------------
|
||||||
|
|
|
@ -230,7 +230,7 @@ module Rails
|
||||||
#
|
#
|
||||||
# If +MyEngine+ is isolated, The routes above will point to
|
# If +MyEngine+ is isolated, The routes above will point to
|
||||||
# <tt>MyEngine::ArticlesController</tt>. You also don't need to use longer
|
# <tt>MyEngine::ArticlesController</tt>. You also don't need to use longer
|
||||||
# url helpers like +my_engine_articles_path+. Instead, you should simply use
|
# URL helpers like +my_engine_articles_path+. Instead, you should simply use
|
||||||
# +articles_path+, like you would do with your main application.
|
# +articles_path+, like you would do with your main application.
|
||||||
#
|
#
|
||||||
# To make this behavior consistent with other parts of the framework,
|
# To make this behavior consistent with other parts of the framework,
|
||||||
|
@ -238,7 +238,7 @@ module Rails
|
||||||
# normal Rails app, when you use a namespaced model such as
|
# normal Rails app, when you use a namespaced model such as
|
||||||
# <tt>Namespace::Article</tt>, <tt>ActiveModel::Naming</tt> will generate
|
# <tt>Namespace::Article</tt>, <tt>ActiveModel::Naming</tt> will generate
|
||||||
# names with the prefix "namespace". In an isolated engine, the prefix will
|
# names with the prefix "namespace". In an isolated engine, the prefix will
|
||||||
# be omitted in url helpers and form fields, for convenience.
|
# be omitted in URL helpers and form fields, for convenience.
|
||||||
#
|
#
|
||||||
# polymorphic_url(MyEngine::Article.new)
|
# polymorphic_url(MyEngine::Article.new)
|
||||||
# # => "articles_path" # not "my_engine_articles_path"
|
# # => "articles_path" # not "my_engine_articles_path"
|
||||||
|
@ -286,11 +286,11 @@ module Rails
|
||||||
# Note that the <tt>:as</tt> option given to mount takes the <tt>engine_name</tt> as default, so most of the time
|
# Note that the <tt>:as</tt> option given to mount takes the <tt>engine_name</tt> as default, so most of the time
|
||||||
# you can simply omit it.
|
# you can simply omit it.
|
||||||
#
|
#
|
||||||
# Finally, if you want to generate a url to an engine's route using
|
# Finally, if you want to generate a URL to an engine's route using
|
||||||
# <tt>polymorphic_url</tt>, you also need to pass the engine helper. Let's
|
# <tt>polymorphic_url</tt>, you also need to pass the engine helper. Let's
|
||||||
# say that you want to create a form pointing to one of the engine's routes.
|
# say that you want to create a form pointing to one of the engine's routes.
|
||||||
# All you need to do is pass the helper as the first element in array with
|
# All you need to do is pass the helper as the first element in array with
|
||||||
# attributes for url:
|
# attributes for URL:
|
||||||
#
|
#
|
||||||
# form_for([my_engine, @user])
|
# form_for([my_engine, @user])
|
||||||
#
|
#
|
||||||
|
|
|
@ -95,7 +95,7 @@ module ApplicationTests
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
test "public url methods are not over-written by the asset pipeline" do
|
test "public URL methods are not over-written by the asset pipeline" do
|
||||||
contents = "doesnotexist"
|
contents = "doesnotexist"
|
||||||
cases = {
|
cases = {
|
||||||
asset_url: %r{http://example.org/#{contents}},
|
asset_url: %r{http://example.org/#{contents}},
|
||||||
|
|
|
@ -450,7 +450,7 @@ module ApplicationTests
|
||||||
assert_equal 0, files.length, "Expected application.js asset to be removed, but still exists"
|
assert_equal 0, files.length, "Expected application.js asset to be removed, but still exists"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "asset urls should use the request's protocol by default" do
|
test "asset URLs should use the request's protocol by default" do
|
||||||
app_with_assets_in_view
|
app_with_assets_in_view
|
||||||
add_to_config "config.asset_host = 'example.com'"
|
add_to_config "config.asset_host = 'example.com'"
|
||||||
add_to_env_config "development", "config.assets.digest = false"
|
add_to_env_config "development", "config.assets.digest = false"
|
||||||
|
@ -466,7 +466,7 @@ module ApplicationTests
|
||||||
assert_match('src="https://example.com/assets/application.self.js', last_response.body)
|
assert_match('src="https://example.com/assets/application.self.js', last_response.body)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "asset urls should be protocol-relative if no request is in scope" do
|
test "asset URLs should be protocol-relative if no request is in scope" do
|
||||||
app_file "app/assets/images/rails.png", "notreallyapng"
|
app_file "app/assets/images/rails.png", "notreallyapng"
|
||||||
app_file "app/assets/javascripts/image_loader.js.erb", "var src='<%= image_path('rails.png') %>';"
|
app_file "app/assets/javascripts/image_loader.js.erb", "var src='<%= image_path('rails.png') %>';"
|
||||||
add_to_config "config.assets.precompile = %w{rails.png image_loader.js}"
|
add_to_config "config.assets.precompile = %w{rails.png image_loader.js}"
|
||||||
|
|
|
@ -39,7 +39,7 @@ module ApplicationTests
|
||||||
assert_equal expanded_path, ActionMailer::Base.view_paths[0].to_s
|
assert_equal expanded_path, ActionMailer::Base.view_paths[0].to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
test "allows me to configure default url options for ActionMailer" do
|
test "allows me to configure default URL options for ActionMailer" do
|
||||||
app_file "config/environments/development.rb", <<-RUBY
|
app_file "config/environments/development.rb", <<-RUBY
|
||||||
Rails.application.configure do
|
Rails.application.configure do
|
||||||
config.action_mailer.default_url_options = { :host => "test.rails" }
|
config.action_mailer.default_url_options = { :host => "test.rails" }
|
||||||
|
@ -61,7 +61,7 @@ module ApplicationTests
|
||||||
assert_equal "https", ActionMailer::Base.default_url_options[:protocol]
|
assert_equal "https", ActionMailer::Base.default_url_options[:protocol]
|
||||||
end
|
end
|
||||||
|
|
||||||
test "includes url helpers as action methods" do
|
test "includes URL helpers as action methods" do
|
||||||
app_file "config/routes.rb", <<-RUBY
|
app_file "config/routes.rb", <<-RUBY
|
||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
get "/foo", :to => lambda { |env| [200, {}, []] }, :as => :foo
|
get "/foo", :to => lambda { |env| [200, {}, []] }, :as => :foo
|
||||||
|
|
|
@ -60,7 +60,7 @@ module ApplicationTests
|
||||||
assert_equal "YOU FAILED", last_response.body
|
assert_equal "YOU FAILED", last_response.body
|
||||||
end
|
end
|
||||||
|
|
||||||
test "url generation error when action_dispatch.show_exceptions is set raises an exception" do
|
test "URL generation error when action_dispatch.show_exceptions is set raises an exception" do
|
||||||
controller :foo, <<-RUBY
|
controller :foo, <<-RUBY
|
||||||
class FooController < ActionController::Base
|
class FooController < ActionController::Base
|
||||||
def index
|
def index
|
||||||
|
|
|
@ -40,12 +40,12 @@ module ApplicationTests
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
test "db:create and db:drop without database url" do
|
test "db:create and db:drop without database URL" do
|
||||||
require "#{app_path}/config/environment"
|
require "#{app_path}/config/environment"
|
||||||
db_create_and_drop ActiveRecord::Base.configurations[Rails.env]["database"]
|
db_create_and_drop ActiveRecord::Base.configurations[Rails.env]["database"]
|
||||||
end
|
end
|
||||||
|
|
||||||
test "db:create and db:drop with database url" do
|
test "db:create and db:drop with database URL" do
|
||||||
require "#{app_path}/config/environment"
|
require "#{app_path}/config/environment"
|
||||||
set_database_url
|
set_database_url
|
||||||
db_create_and_drop database_url_db_name
|
db_create_and_drop database_url_db_name
|
||||||
|
|
Loading…
Reference in a new issue