Skip to content

Commit

Permalink
Merge pull request #45451 from jonathanhefner/allow_deprecated_singul…
Browse files Browse the repository at this point in the history
…ar_associations_name-default-tests

Fix `allow_deprecated_singular_associations_name` framework default
  • Loading branch information
byroot committed Jun 25, 2022
2 parents 1d67200 + 369afa6 commit 4a94f4a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
Expand Up @@ -46,4 +46,4 @@
# Rails.application.config.active_record.sqlite3_adapter_strict_strings_by_default = true

# Disable deprecated singular associations names
# Rails.application.config.active_record.allow_deprecated_singular_associations_name = true
# Rails.application.config.active_record.allow_deprecated_singular_associations_name = false
26 changes: 26 additions & 0 deletions railties/test/application/configuration_test.rb
Expand Up @@ -2383,6 +2383,32 @@ def index
assert_equal true, ActiveRecord.verify_foreign_keys_for_fixtures
end

test "ActiveRecord.allow_deprecated_singular_associations_name is false by default for new apps" do
app "development"

assert_equal false, ActiveRecord.allow_deprecated_singular_associations_name
end

test "ActiveRecord.allow_deprecated_singular_associations_name is true by default for upgraded apps" do
remove_from_config '.*config\.load_defaults.*\n'

app "development"

assert_equal true, ActiveRecord.allow_deprecated_singular_associations_name
end

test "ActiveRecord.allow_deprecated_singular_associations_name can be configured via config.active_record.allow_deprecated_singular_associations_name" do
remove_from_config '.*config\.load_defaults.*\n'

app_file "config/initializers/new_framework_defaults_7_1.rb", <<-RUBY
Rails.application.config.active_record.allow_deprecated_singular_associations_name = false
RUBY

app "development"

assert_equal false, ActiveRecord.allow_deprecated_singular_associations_name
end

test "ActiveRecord::Base.run_commit_callbacks_on_first_saved_instances_in_transaction is false by default for new apps" do
app "development"

Expand Down

0 comments on commit 4a94f4a

Please sign in to comment.