How to get nested attributes hash with machinist?

285 Views Asked by At

so I'm trying to write some controller tests for quite complex nested form. I have machinist which works fine for model tests but I can't get a nested hash out of it to use for a post request in controller test.

What is a best way to handle this?

1

There are 1 best solutions below

0
On

Machinist is dedicated to creating model instances and filling their attributes and associations, not just any objects. Though its readme calls them 'objects', code samples cover models instantiation only. Thus you have to create your controller params in tests code, probably moving that to test helpers if it's too cumbersome to fit right into test files.