I’m trying to get started with TDD but I’m struggling with the combination of multi-tenancy using default_scope, Devise for authentication and Factory Girl factories.
Most of the ‘getting started’ guides I see simply use
association: whatever in the factory to build random parent/related objects but when those objects are the tenant I need it to be more controlled.
My model tests are ok because they’re isolated but as soon as I try to test any kind of integration I can’t control the tenants without writing lots of code in the test.
I should point out that my app is live and is currently tested manually (gulp!) so I’m not able to make sweeping changes like switching to schema-based multi-tenancy etc.
Users: Teacher, Student
All teachers and students belong_to a school. All students are assigned to teachers through classes. All lessons are created by teachers and belong_to students.
I realize this is a massively broad question but I’d be grateful of any resources or guides for how I should proceed testing this particular setup.