Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Ruby 3 compatibility

Đang mở
#677 9 bình luận 9 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
28/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
ruby
Lĩnh vực
testing

Hướng nghiên cứu

Bắt đầu bằng cách so sánh lib/database_cleaner/cleaner.rb với các điểm truy cập xử lý tùy chọn trong database_cleaner-active_record/lib/database_cleaner/active_record/truncation.rb và database_cleaner-redis/lib/database_cleaner/redis/deletion.rb. Chạy các specs PostgreSQL, MySQL và SQLite hiện có, sau đó kiểm tra lệnh gọi strategy= được báo cáo trên Ruby 3. Hoàn thành khi các sub-gems xử lý các tùy chọn một cách nhất quán và các lỗi tương thích được bao phủ bởi các specs đạt.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Have there been any efforts already on getting this gem ready for Ruby 3?

this kind of magic: https://github.com/DatabaseCleaner/database_cleaner/blob/master/lib/database_cleaner/cleaner.rb#L43

    def strategy=(args)
      strategy, *strategy_args = args

won't work in Ruby 3, I've seen quite some usage of this pattern.

Also, the redis and the active_record sub-gems use kwargs vs. options-hashes differently, see:

options hash: https://github.com/DatabaseCleaner/database_cleaner-active_record/blob/master/lib/database_cleaner/active_record/truncation.rb#L8

class Truncation < Base
  def initialize(opts={})

kwargs: https://github.com/DatabaseCleaner/database_cleaner-redis/blob/master/lib/database_cleaner/redis/deletion.rb#L6

    class Deletion < Strategy
      def initialize only: [], except: []

which will make it harder to upgrade the database gem family.

So probably as a first step, we should harmonize all sub-gems to use the same way of passing options around, either as a hash or using keyword arguments. From there we can tinker further.

I've tried it quickly locally and run into too many issues to push a draft PR. I might find more time on one of the next weekends though. -> hence the question, if there is already any PR/fork that started working on Ruby 3 compatibility.

As always, thanks for the gems 🙂

=> Specs are passing for Postgresql, MySQL, SQLlite locally, however, when I use

DatabaseCleaner.strategy = :deletion, { except: %i[not_you also_not_you blubb] }

in one of my projects, strategy= fails with the Ruby 3 kwargs/hash error.

Ngôn ngữ chính
Ruby
Star
3k
Fork
485
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

  • Có Dockerfile hoặc tệp Docker Compose
  • Không có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của DatabaseCleaner/database_cleaner

Tất cả issue của DatabaseCleaner/database_cleaner

Issue tương tự

Thêm issue về Ruby

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.