3 ms·
I think it's less that running database tests is bad, but more that your business objects (models) should not be so tightly coupled to your ORM. All of the busi
by kyllo 13y ago
I think it's less that running database tests is bad, but more that your business objects (models) should not be so tightly coupled to your ORM. All of the business logic is supposed to go in the models, but the models inherit from ActiveRecord::Base so therefore you're stuck with ActiveRecord forever and you can't test any business logic until after you do a schema migration. It places the database at the center of the development process, because the first thing you have to do is design the database schema, before anything else will work.
Instead, you really should be writing (and testing) business logic first, and figuring out what your objects/models are going to be through a gradual refactoring process. Then you can design your persistence schema after your objects and their relationships are fully fleshed out.
Rails is really a database-driven development tool, but guys like Uncle Bob are arguing that database-driven development is an anti-pattern.