Add cleaning_with method
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 42/100
Hướng nghiên cứu
Bắt đầu bằng cách đọc các API cleaning và strategy hiện có được issue tham chiếu, đặc biệt là Base và entry point DatabaseCleaner ở cấp module. Thêm hành vi cleaning theo từng test được yêu cầu mà không thay đổi strategy trên toàn cục, sau đó xác minh rằng hành vi này hoạt động trên các connection đã cấu hình, bằng các test tập trung cho cả hai entry point.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hi,
I'm slowly transitioning my tests to use transaction based cleaning instead of truncation. To do this, I'm currently using an around method which will use the strategy I want only for that test;
around(:each) { |example| DatabaseCleaner.cleaning_with(:transaction, &example) }
This is my extension:
module DatabaseCleaner
class Base
def cleaning_with(*args, &block)
create_strategy(*args).cleaning(&block)
end
end
class << self
def cleaning_with(*args, &inner_block)
connections.reduce(inner_block) do |curr_block, connection|
proc { connection.cleaning_with(*args, &curr_block) }
end.call
end
end
end
Would you consider adding this to the project itself? Btw, I realise doing this introduces some code repetition, I haven't yet looked at that because I didn't want to touch the original source code yet ;-)
- 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
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của DatabaseCleaner/database_cleaner
-
:transaction strategy: uncommitted data disappears after perform_enqueued_jobs on Rails ≥ 7.2Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 67/100
-
Cleaning of dev DBĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
-
Cannot truncate a table referenced in a foreign key constraint (ActiveRecord::StatementInvalid)Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
DatabaseCleaner/database_cleaner#717 · 5 bình luận · 1 reaction ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
DatabaseCleaner/database_cleaner#716 · 2 bình luận ·
Tất cả issue của DatabaseCleaner/database_cleaner
Issue tương tự
-
Add Catalan (ca) translationĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
eurosky-social/eu-haul#32 ·
-
README configuration examples use the wrong module name and describe removed Bootstrap assetsĐang mởgood first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
benbalter/add-to-org#17 ·
-
good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
benbalter/change_agent#11 ·
-
good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
benbalter/count-org-loc#20 ·
-
good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
benbalter/sitemap-parser#33 ·