Change yaml
to YAML
This commit is contained in:
parent
d907b4420e
commit
3b7f55c179
@ -13,7 +13,7 @@ class ParametersSerializationTest < ActiveSupport::TestCase
|
|||||||
ActionController::Parameters.permit_all_parameters = @old_permitted_parameters
|
ActionController::Parameters.permit_all_parameters = @old_permitted_parameters
|
||||||
end
|
end
|
||||||
|
|
||||||
test "yaml serialization" do
|
test "YAML serialization" do
|
||||||
params = ActionController::Parameters.new(key: :value)
|
params = ActionController::Parameters.new(key: :value)
|
||||||
yaml_dump = YAML.dump(params)
|
yaml_dump = YAML.dump(params)
|
||||||
assert_match("--- !ruby/object:ActionController::Parameters", yaml_dump)
|
assert_match("--- !ruby/object:ActionController::Parameters", yaml_dump)
|
||||||
@ -21,7 +21,7 @@ class ParametersSerializationTest < ActiveSupport::TestCase
|
|||||||
assert_match("permitted: false", yaml_dump)
|
assert_match("permitted: false", yaml_dump)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "yaml deserialization" do
|
test "YAML deserialization" do
|
||||||
params = ActionController::Parameters.new(key: :value)
|
params = ActionController::Parameters.new(key: :value)
|
||||||
payload = YAML.dump(params)
|
payload = YAML.dump(params)
|
||||||
roundtripped = YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(payload) : YAML.load(payload)
|
roundtripped = YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(payload) : YAML.load(payload)
|
||||||
@ -30,7 +30,7 @@ class ParametersSerializationTest < ActiveSupport::TestCase
|
|||||||
assert_not_predicate roundtripped, :permitted?
|
assert_not_predicate roundtripped, :permitted?
|
||||||
end
|
end
|
||||||
|
|
||||||
test "yaml backwardscompatible with psych 2.0.8 format" do
|
test "YAML backwardscompatible with psych 2.0.8 format" do
|
||||||
payload = <<~end_of_yaml
|
payload = <<~end_of_yaml
|
||||||
--- !ruby/hash:ActionController::Parameters
|
--- !ruby/hash:ActionController::Parameters
|
||||||
key: :value
|
key: :value
|
||||||
@ -41,7 +41,7 @@ class ParametersSerializationTest < ActiveSupport::TestCase
|
|||||||
assert_not_predicate params, :permitted?
|
assert_not_predicate params, :permitted?
|
||||||
end
|
end
|
||||||
|
|
||||||
test "yaml backwardscompatible with psych 2.0.9+ format" do
|
test "YAML backwardscompatible with psych 2.0.9+ format" do
|
||||||
payload = <<~end_of_yaml
|
payload = <<~end_of_yaml
|
||||||
--- !ruby/hash-with-ivars:ActionController::Parameters
|
--- !ruby/hash-with-ivars:ActionController::Parameters
|
||||||
elements:
|
elements:
|
||||||
|
@ -11,7 +11,7 @@ def yaml_params
|
|||||||
class ActionControllerParametersIntegrationTest < ActionController::TestCase
|
class ActionControllerParametersIntegrationTest < ActionController::TestCase
|
||||||
tests IntegrationController
|
tests IntegrationController
|
||||||
|
|
||||||
test "parameters can be serialized as yaml" do
|
test "parameters can be serialized as YAML" do
|
||||||
post :yaml_params, params: { person: { name: "Mjallo!" } }
|
post :yaml_params, params: { person: { name: "Mjallo!" } }
|
||||||
expected = <<~YAML
|
expected = <<~YAML
|
||||||
--- !ruby/object:ActionController::Parameters
|
--- !ruby/object:ActionController::Parameters
|
||||||
|
@ -11,7 +11,7 @@ class ConnectionPool
|
|||||||
# the connection pool.
|
# the connection pool.
|
||||||
#
|
#
|
||||||
# Configure the frequency by setting +reaping_frequency+ in your database
|
# Configure the frequency by setting +reaping_frequency+ in your database
|
||||||
# yaml file (default 60 seconds).
|
# YAML file (default 60 seconds).
|
||||||
class Reaper
|
class Reaper
|
||||||
attr_reader :pool, :frequency
|
attr_reader :pool, :frequency
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
require_relative "abstract_unit"
|
require_relative "abstract_unit"
|
||||||
|
|
||||||
class ConfigurationFileTest < ActiveSupport::TestCase
|
class ConfigurationFileTest < ActiveSupport::TestCase
|
||||||
test "backtrace contains yaml path" do
|
test "backtrace contains YAML path" do
|
||||||
Tempfile.create do |file|
|
Tempfile.create do |file|
|
||||||
file.write("wrong: <%= foo %>")
|
file.write("wrong: <%= foo %>")
|
||||||
file.rewind
|
file.rewind
|
||||||
@ -16,7 +16,7 @@ class ConfigurationFileTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
test "backtrace contains yaml path (when Pathname given)" do
|
test "backtrace contains YAML path (when Pathname given)" do
|
||||||
Tempfile.create do |file|
|
Tempfile.create do |file|
|
||||||
file.write("wrong: <%= foo %>")
|
file.write("wrong: <%= foo %>")
|
||||||
file.rewind
|
file.rewind
|
||||||
|
@ -723,7 +723,7 @@ The Redis adapter requires users to provide a URL pointing to the Redis server.
|
|||||||
Additionally, a `channel_prefix` may be provided to avoid channel name collisions
|
Additionally, a `channel_prefix` may be provided to avoid channel name collisions
|
||||||
when using the same Redis server for multiple applications. See the [Redis PubSub documentation](https://redis.io/topics/pubsub#database-amp-scoping) for more details.
|
when using the same Redis server for multiple applications. See the [Redis PubSub documentation](https://redis.io/topics/pubsub#database-amp-scoping) for more details.
|
||||||
|
|
||||||
The Redis adapter also supports SSL/TLS connections. The required SSL/TLS parameters can be passed in `ssl_params` key in the configuration yaml file.
|
The Redis adapter also supports SSL/TLS connections. The required SSL/TLS parameters can be passed in `ssl_params` key in the configuration YAML file.
|
||||||
|
|
||||||
```
|
```
|
||||||
production:
|
production:
|
||||||
|
@ -1960,7 +1960,7 @@ def index
|
|||||||
assert_equal true, Rails.application.config.action_mailer.show_previews
|
assert_equal true, Rails.application.config.action_mailer.show_previews
|
||||||
end
|
end
|
||||||
|
|
||||||
test "config_for loads custom configuration from yaml accessible as symbol or string" do
|
test "config_for loads custom configuration from YAML accessible as symbol or string" do
|
||||||
set_custom_config <<~RUBY
|
set_custom_config <<~RUBY
|
||||||
development:
|
development:
|
||||||
foo: "bar"
|
foo: "bar"
|
||||||
@ -1972,7 +1972,7 @@ def index
|
|||||||
assert_equal "bar", Rails.application.config.my_custom_config["foo"]
|
assert_equal "bar", Rails.application.config.my_custom_config["foo"]
|
||||||
end
|
end
|
||||||
|
|
||||||
test "config_for loads nested custom configuration from yaml as symbol keys" do
|
test "config_for loads nested custom configuration from YAML as symbol keys" do
|
||||||
set_custom_config <<~RUBY
|
set_custom_config <<~RUBY
|
||||||
development:
|
development:
|
||||||
foo:
|
foo:
|
||||||
|
Loading…
Reference in New Issue
Block a user