2 Matching Annotations
- Sep 2024
-
stackoverflow.com stackoverflow.com
-
Disable all observers in your test suite by default. They should not be complicating your model tests because they should have separate concerns anyway. You don't need to unit test that observers actually fire, because ActiveRecord's test suite does that, and your integration tests will cover it.
-
Rails' observers were partly inspired by aspect-oriented programming -- they're about cross-cutting concerns. If you're putting business logic in observers that is tightly coupled to the models they're observing, you're doing it wrong IMO.
Tags
- testing: only test the thing you're trying to test
- tightly coupled
- aspect-oriented programming
- separation of concerns
- good policy/practice/procedure
- software development: code organization: where does this code belong?
- observer pattern
- testing: avoid over-testing: don't test the same thing in many different tests
Annotators
URL
-