Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be able to get attributes from Factory as named tuple #371

Open
confact opened this issue May 23, 2020 · 2 comments
Open

Be able to get attributes from Factory as named tuple #371

confact opened this issue May 23, 2020 · 2 comments

Comments

@confact
Copy link
Contributor

confact commented May 23, 2020

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.

@jwoertink
Copy link
Member

A Box is just a custom SaveOperation. You should be able to do something like:

box = UserBox.create
box.attributes

@paulcsmith
Copy link
Member

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

@jwoertink jwoertink changed the title Be able to get attributes from box as named tuple Be able to get attributes from Factory as named tuple Oct 1, 2022
@jwoertink jwoertink added the hacktoberfest Valid Issue for Hacktoberfest label Oct 1, 2022
@jwoertink jwoertink removed the hacktoberfest Valid Issue for Hacktoberfest label Nov 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants