Allow setting raise_on_mismatches to base class level for tests
- Ngôn ngữ chính
- Ruby
- Star
- 7.8k
- Fork
- 505
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
We are using a base experiment class to manage our publish logic. All the actual experiments are extending from this base class. However, if we set raise_on_mismatches to this base class the result doesn't take effect as the method is using class instance variables(instead of class variables). In the end, people occasionally forget to use this test helper for their newly created experiments.
It would be great if we can manage this test helper via a base class. To elaborate more on this, this is somewhat our structure;
```ruby
class BaseExperiment
include Scientist::Experiment
def initialize
# setting up some instance variables mainly needed for publish logic
end
def publish(result)
# some custom logic
end
end
class WidgetExperiment < BaseExperiment
def initialize
# setting up custom variables
super
end
def enabled?
# custom enabled logic
end
end
class AnotherExperiment < BaseExperiment
# similar context with widget experiment
end
```
What we want is to use `BaseExperiment.raise_on_mismatches = true` to ensure all child experiments are tested on tests without needed a separate test setup. Would such a need make sense to you?
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu bằng cách theo dõi cách triển khai raise_on_mismatches trong Scientist::Experiment và cách nó được cấu hình trên các lớp experiment. Bổ sung coverage cho việc thiết lập BaseExperiment.raise_on_mismatches và xác minh rằng các experiment con tuân theo thiết lập này mà không cần thiết lập test riêng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- ruby
- Lĩnh vực
- backend
- Loại issue
- Tính năng
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 30/100