avram
avram copied to clipboard
Be able to get attributes from Factory as named tuple
I want to test methods and classes with params from my boxes.
It would be amazing to be able to get generated attributes from boxes as NamedTuple
for passing to methods or something else.
A Box is just a custom SaveOperation. You should be able to do something like:
box = UserBox.create
box.attributes
The problem with that is you need to create the record. If you want to use this to test Api:Users::Create for example this would not work quite right.
I think what this needs is #34 for building an unsaved model with a fake id. Then we can use that for something like UserBox.attributes
or UserBox.attributes &.name("whatever")
. This would be super awesome for testing APIs