-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add FOSTERER_PERMISSIONS * Move the role assignment callback from the AdopterFosterAccount factory to the User factory, and make default user type for AdopterFosterAccount factory :adopter * Add fosterer factory * Add fosterer context to policy tests * Add staff and staff_admin contexts to Organizations::AdoptablePetPolicyTest * Refactor staff and staff_admin factories to move role association logic from account factory to user factory * Add dashboard permission to FOSTERER_PERMISSIONS
- Loading branch information
Showing
21 changed files
with
361 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,11 @@ | ||
FactoryBot.define do | ||
factory :adopter_foster_account do | ||
user { association :user } | ||
user { association :adopter } | ||
|
||
trait :with_profile do | ||
adopter_foster_profile do | ||
association :adopter_foster_profile, adopter_foster_account: instance | ||
end | ||
end | ||
|
||
after(:build) do |_account, context| | ||
context.user.add_role(:adopter, context.user.organization) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,10 @@ | ||
FactoryBot.define do | ||
factory :staff_account do | ||
user { association :user } | ||
user { association :staff } | ||
deactivated_at { nil } | ||
|
||
trait :deactivated do | ||
deactivated_at { DateTime.now } | ||
end | ||
|
||
trait :admin do | ||
after(:build) do |_account, context| | ||
context.user.add_role(:admin, context.organization) | ||
end | ||
end | ||
|
||
after(:build) do |_account, context| | ||
context.user.add_role(:staff, context.organization) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.