-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
sdg.rb
31 lines (26 loc) · 894 Bytes
/
sdg.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
FactoryBot.define do
factory :sdg_goal, class: "SDG::Goal" do
sequence(:code) { |n| n }
end
factory :sdg_target, class: "SDG::Target" do
sequence(:code, 1) { |n| "#{n}.#{n}" }
end
factory :sdg_local_target, class: "SDG::LocalTarget" do
code { "1.1.1" }
sequence(:title) { |n| "Local Target #{n} title" }
sequence(:description) { |n| "Help for Local Target #{n}" }
target { SDG::Target[code.rpartition(".").first] }
goal { SDG::Goal[code.split(".")[0]] }
end
factory :sdg_phase, class: "SDG::Phase" do
kind { :sensitization }
end
factory :sdg_review, class: "SDG::Review" do
SDG::Related::RELATABLE_TYPES.map { |relatable_type| relatable_type.downcase.gsub("::", "_") }
.each do |relatable|
trait :"#{relatable}_review" do
association :relatable, factory: relatable
end
end
end
end