Priority: Mediumhelp wanted
Repository metrics
- Stars
- (40 stars)
- PR merge metrics
- (PR metrics pending)
Description
We have need for varied user, box_request, box, and box_item factory traits (We have existing factories) for use in tests, and later to create seed data.
If we had box traits that mimic the methods in the box model such as design_claimed, design_completed, shipping_claimed, shipping_completed where the relevant *_by_id,*_at, and aasm_state were populated, that'd be amazing. For user, we need a trait for each constant in the Permission model.
This would allow us to skip all the cajoling we had to do in box_spec.rb.
Instead, it'd be so awesome to be able to call something like:
designer = create(:designer)bc there was already a traitdesigneron user who had an associatedcreate(:user_permission, name: Permission::BOX_DESIGNER)assembled_box = create(:box, :is_assembled), which also has/mimics the traits :is_designed, :is_researched, box_request#is_reviewed, etc, bc our/box_requestsindex needs all the prior lifecycle phase to be true and all future lifecycle phases to be untrue to display correctly.box_item_with_research_needed = create(:box_item_research_needed)that is a trait on box_item that who has an associatedcreate(:inventory_type, research_needed: true)
You might want to check out:
- Background doc (linked from README)
- is_reviewed, is_shipped, etc, methods in
box_rb aasmblocks in thebox_requestandbox.rbmodelsbox_requests/index.html.erborlocalhost:3000/box_requestsin your local browserdatabase-diagram.png, linked from READMEspec/models/box_spec.rbto see how we can manually walk box_requests along in the process.