Skip to content

Tests for upsert_all and insert_all fail in Rails v8 #462

@armg-kosuke-toyama

Description

@armg-kosuke-toyama

The Rails7-stable test passed on my local environment, but the Rails8.0.0 test failed with upsert_all and insert_all.
The conversion from symbols to numbers does not seem to be working.

Rails7 stable

BUNDLE_GEMFILE=Gemfile.rails71 bundle install
Fetching https://github.com/mongodb/mongoid.git
Fetching https://github.com/rails/rails.git
Updating files: 100% (4689/4689), done.
Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies...
Fetching cgi 0.5.0
Installing cgi 0.5.0 with native extensions
Bundle complete! 9 Gemfile dependencies, 72 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

BUNDLE_GEMFILE=Gemfile.rails71 bundle exec rake test
/Users/kosuke.toyama/.asdf/installs/ruby/3.3.4/bin/ruby -w -I"lib:test" /Users/kosuke.toyama/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/rake-13.3.0/lib/rake/rake_test_loader.rb "test/activemodel_test.rb" "test/activerecord_test.rb" "test/attribute_map_test.rb" "test/attribute_test.rb" "test/base_test.rb" "test/formtastic_test.rb" "test/module_attributes_test.rb" "test/mongo_mapper_test.rb" "test/mongoid_test.rb" "test/multiple_test.rb" "test/predicates_test.rb" "test/rails_admin_test.rb" "test/sequel_test.rb" "test/set_test.rb" "test/simple_form_test.rb" "test/value_test.rb" 
DEPRECATION WARNING: Support for `config.active_support.cache_format_version = 6.1` has been deprecated and will be removed in Rails 7.2.

Check the Rails upgrade guide at https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#new-activesupport-cache-serialization-format
for more information on how to upgrade.
 (called from <top (required)> at /Users/kosuke.toyama/develop/enumerize/test/test_helper.rb:32)
/Users/kosuke.toyama/develop/enumerize/test/activerecord_test.rb:473: warning: assigned but unused variable - document_2
/Users/kosuke.toyama/develop/enumerize/test/sequel_test.rb:304: warning: assigned but unused variable - document_2
Run options: --seed 3973

# Running:

..................................................................................................................................................................................................................................................

Finished in 0.424167s, 570.5300 runs/s, 997.2487 assertions/s.
242 runs, 423 assertions, 0 failures, 0 errors, 0 skips

Rails8 stable

BUNDLE_GEMFILE=Gemfile.rails80 bundle install
Fetching https://github.com/rails/rails.git
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Using activesupport 8.0.2 (was 8.0.0) from https://github.com/rails/rails.git (at 8-0-stable@604103e)
Using activemodel 8.0.2 (was 8.0.0) from https://github.com/rails/rails.git (at 8-0-stable@604103e)
Using actionview 8.0.2 (was 8.0.0) from https://github.com/rails/rails.git (at 8-0-stable@604103e)
Using activejob 8.0.2 (was 8.0.0) from https://github.com/rails/rails.git (at 8-0-stable@604103e)
Using actionpack 8.0.2 (was 8.0.0) from https://github.com/rails/rails.git (at 8-0-stable@604103e)
Using activerecord 8.0.2 (was 8.0.0) from https://github.com/rails/rails.git (at 8-0-stable@604103e)
Using actioncable 8.0.2 (was 8.0.0) from https://github.com/rails/rails.git (at 8-0-stable@604103e)
Using activestorage 8.0.2 (was 8.0.0) from https://github.com/rails/rails.git (at 8-0-stable@604103e)
Using railties 8.0.2 (was 8.0.0) from https://github.com/rails/rails.git (at 8-0-stable@604103e)
Using actionmailbox 8.0.2 (was 8.0.0) from https://github.com/rails/rails.git (at 8-0-stable@604103e)
Using actiontext 8.0.2 (was 8.0.0) from https://github.com/rails/rails.git (at 8-0-stable@604103e)
Using actionmailer 8.0.2 (was 8.0.0) from https://github.com/rails/rails.git (at 8-0-stable@604103e)
Using rails 8.0.2 (was 8.0.0) from https://github.com/rails/rails.git (at 8-0-stable@604103e)
Bundle complete! 9 Gemfile dependencies, 72 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
BUNDLE_GEMFILE=Gemfile.rails80 bundle exec rake test
/Users/kosuke.toyama/.asdf/installs/ruby/3.3.4/bin/ruby -w -I"lib:test" /Users/kosuke.toyama/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/rake-13.3.0/lib/rake/rake_test_loader.rb "test/activemodel_test.rb" "test/activerecord_test.rb" "test/attribute_map_test.rb" "test/attribute_test.rb" "test/base_test.rb" "test/formtastic_test.rb" "test/module_attributes_test.rb" "test/mongo_mapper_test.rb" "test/mongoid_test.rb" "test/multiple_test.rb" "test/predicates_test.rb" "test/rails_admin_test.rb" "test/sequel_test.rb" "test/set_test.rb" "test/simple_form_test.rb" "test/value_test.rb" 
DEPRECATION WARNING: `to_time` will always preserve the receiver timezone rather than system local time in Rails 8.1. To opt in to the new behavior, set `config.active_support.to_time_preserves_timezone = :zone`. (called from <top (required)> at /Users/kosuke.toyama/develop/enumerize/test/test_helper.rb:32)
/Users/kosuke.toyama/develop/enumerize/test/activerecord_test.rb:473: warning: assigned but unused variable - document_2
/Users/kosuke.toyama/develop/enumerize/test/sequel_test.rb:304: warning: assigned but unused variable - document_2
Run options: --seed 5322

# Running:

.........................................................................................................................F..................................................F.....................................................................

Finished in 0.609400s, 397.1119 runs/s, 690.8435 assertions/s.

  1) Failure:
ActiveRecordTest#test_0061_supports AR#insert_all [test/activerecord_test.rb:742]:
Expected: true
  Actual: false

  2) Failure:
ActiveRecordTest#test_0062_supports AR#upsert_all [test/activerecord_test.rb:754]:
Expected: true
  Actual: false

242 runs, 421 assertions, 2 failures, 0 errors, 0 skips
rake aborted!
Command failed with status (1): [ruby -w -I"lib:test" /Users/kosuke.toyama/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/rake-13.3.0/lib/rake/rake_test_loader.rb "test/activemodel_test.rb" "test/activerecord_test.rb" "test/attribute_map_test.rb" "test/attribute_test.rb" "test/base_test.rb" "test/formtastic_test.rb" "test/module_attributes_test.rb" "test/mongo_mapper_test.rb" "test/mongoid_test.rb" "test/multiple_test.rb" "test/predicates_test.rb" "test/rails_admin_test.rb" "test/sequel_test.rb" "test/set_test.rb" "test/simple_form_test.rb" "test/value_test.rb" ]
/Users/kosuke.toyama/.asdf/installs/ruby/3.3.4/bin/bundle:25:in `load'
/Users/kosuke.toyama/.asdf/installs/ruby/3.3.4/bin/bundle:25:in `<main>'
Tasks: TOP => test
(See full trace by running task with --trace)

I tried running the test with Rails v8.0.0 and got the same error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions