Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
aoz-003
Commits
2192517f
Verified
Commit
2192517f
authored
May 03, 2018
by
Kaspar Vollenweider
👻
Browse files
add factory for terminated group offer and group_assignment
parent
f09ce619
Changes
2
Hide whitespace changes
Inline
Side-by-side
test/factories/group_assignment.rb
View file @
2192517f
...
...
@@ -11,5 +11,23 @@ FactoryBot.define do
group_assignment
.
volunteer
=
create
(
:volunteer_with_user
)
if
group_assignment
.
volunteer
.
blank?
group_assignment
.
group_offer
=
create
(
:group_offer
)
if
group_assignment
.
group_offer
.
blank?
end
factory
:terminated_group_assignment
do
period_end
{
4
.
days
.
ago
}
termination_submitted_at
{
3
.
days
.
ago
}
termination_verified_at
{
2
.
days
.
ago
}
association
:period_end_set_by
,
factory: :user
after
(
:build
)
do
|
group_assignment
|
if
group_assignment
.
volunteer
.
blank?
group_assignment
.
volunteer
=
create
(
:volunteer_with_user
)
end
group_assignment
.
termination_submitted_by
=
group_assignment
.
volunteer
.
user
group_assignment
.
termination_verified_by
=
group_assignment
.
period_end_set_by
group_assignment
.
group_offer
=
create
(
:group_offer
)
if
group_assignment
.
group_offer
.
blank?
end
after
(
:create
)
do
|
group_assignment
|
group_assignment
.
create_log_of_self
end
end
end
end
test/factories/group_offers.rb
View file @
2192517f
...
...
@@ -21,5 +21,11 @@ FactoryBot.define do
location
{
FFaker
::
Address
.
city
}
organization
{
FFaker
::
Company
.
name
}
end
trait
:terminated
do
period_end
{
2
.
days
.
ago
}
association
:period_end_set_by
,
factory: :user
active
{
false
}
end
end
end
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment