-
-
Notifications
You must be signed in to change notification settings - Fork 82
Add factorybot box traits #430
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
base: develop
Are you sure you want to change the base?
Changes from all commits
ce2fed3
7899e06
fe377d4
bb6d84d
241bff3
4749761
7d1765b
d3f13a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,82 @@ | ||
FactoryBot.define do | ||
factory :box do | ||
|
||
box_request | ||
|
||
trait :reviewed do | ||
box_request {(create(:box_request, :reviewed))} | ||
end | ||
|
||
trait :design_in_progress do | ||
after(:create) { |box| box.check_has_box_items } | ||
reviewed | ||
aasm_state { "design_in_progress"} | ||
designed_by_id {create(:user, :designer).id} | ||
design_reviewed_by_id {create(:user, :reviewer).id} | ||
design_reviewed_at { Time.now } | ||
end | ||
|
||
trait :designed_no_research do | ||
design_in_progress | ||
designed_at { Time.now } | ||
aasm_state { "designed"} | ||
box_items {create_list(:box_item, 1, :no_research_needed)} | ||
end | ||
|
||
trait :designed_needs_research do | ||
design_in_progress | ||
designed_at { Time.now } | ||
aasm_state { "designed"} | ||
box_items {create_list(:box_item, 1, :research_needed)} | ||
end | ||
|
||
trait :research_in_progress do | ||
designed_needs_research | ||
aasm_state {"research_in_progress"} | ||
researched_by_id {create(:user, :researcher).id} | ||
end | ||
|
||
trait :researched do | ||
research_in_progress | ||
after(:build) { |box| box.mark_box_items_as_researched! } | ||
aasm_state {"researched"} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should roll up from box_items, which each have |
||
end | ||
|
||
trait :assembly_in_progress do | ||
researched | ||
aasm_state {"assembly_in_progress"} | ||
assembled_by_id {create(:user, :assembler).id} | ||
end | ||
|
||
trait :assembled do | ||
assembly_in_progress | ||
aasm_state {"assembled"} | ||
RachelWyatt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
assembled_at { Time.now } | ||
end | ||
|
||
trait :shipping_in_progress do | ||
assembled | ||
aasm_state {"shipping_in_progress"} | ||
shipped_by_id {create(:user, :shipper).id} | ||
end | ||
|
||
trait :shipped do | ||
shipping_in_progress | ||
aasm_state {"shipped"} | ||
RachelWyatt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
shipped_at { Time.now } | ||
end | ||
|
||
trait :follow_up_in_progress do | ||
shipping_in_progress | ||
aasm_state {"follow_up_in_progress"} | ||
followed_up_by_id {create(:user, :follow_upper).id} | ||
end | ||
|
||
trait :followed_up do | ||
follow_up_in_progress | ||
aasm_state {"followed_up"} | ||
RachelWyatt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
followed_up_at { Time.now } | ||
end | ||
|
||
end | ||
end |
Uh oh!
There was an error while loading. Please reload this page.