1
|
|
|
# frozen_string_literal: true |
2
|
|
|
|
3
|
|
|
# Factory to create or return test objects |
4
|
|
|
class TestFactory |
5
|
|
|
def self.test_arm |
6
|
|
|
@test_arm ||= FactoryBot.create(:test_arm) |
7
|
|
|
end |
8
|
|
|
|
9
|
|
|
def self.test_assessment |
10
|
|
|
@test_assessment ||= FactoryBot.create(:test_assessment) |
11
|
|
|
end |
12
|
|
|
|
13
|
|
|
def self.test_assessment_instrument |
14
|
|
|
@test_assessment_instrument ||= |
15
|
|
|
FactoryBot.create(:test_assessment_instrument) |
16
|
|
|
end |
17
|
|
|
|
18
|
|
|
def self.test_choice |
19
|
|
|
@test_choice ||= FactoryBot.create(:test_choice) |
20
|
|
|
end |
21
|
|
|
|
22
|
|
|
def self.test_participant |
23
|
|
|
@test_participant ||= FactoryBot.create(:test_participant) |
24
|
|
|
end |
25
|
|
|
|
26
|
|
|
def self.test_schedule |
27
|
|
|
@test_schedule ||= FactoryBot.create(:test_schedule) |
28
|
|
|
end |
29
|
|
|
|
30
|
|
|
def self.test_study |
31
|
|
|
@test_study ||= FactoryBot.create(:test_study) |
32
|
|
|
end |
33
|
|
|
|
34
|
|
|
def self.test_study_event |
35
|
|
|
@test_study_event ||= FactoryBot.create(:test_study_event) |
36
|
|
|
end |
37
|
|
|
|
38
|
|
|
def self.test_study_participant |
39
|
|
|
@test_study_participant ||= FactoryBot.create(:test_study_participant) |
40
|
|
|
end |
41
|
|
|
|
42
|
|
|
def self.test_survey_participant |
43
|
|
|
@test_survey_participant ||= FactoryBot.create(:test_survey_participant) |
44
|
|
|
end |
45
|
|
|
|
46
|
|
|
def self.test_study_event_instrument |
47
|
|
|
@test_study_event_instrument ||= |
48
|
|
|
FactoryBot.create(:test_study_event_instrument) |
49
|
|
|
end |
50
|
|
|
|
51
|
|
|
def self.test_journal |
52
|
|
|
@test_journal ||= FactoryBot.create(:test_journal) |
53
|
|
|
end |
54
|
|
|
|
55
|
|
|
def self.test_journal_entry |
56
|
|
|
@test_journal_entry ||= FactoryBot.create(:test_journal_entry) |
57
|
|
|
end |
58
|
|
|
|
59
|
|
|
def self.test_survey |
60
|
|
|
@test_survey ||= FactoryBot.create(:test_survey) |
61
|
|
|
end |
62
|
|
|
|
63
|
|
|
def self.test_user |
64
|
|
|
@test_user ||= FactoryBot.create(:test_user) |
65
|
|
|
end |
66
|
|
|
|
67
|
|
|
def self.test_visit |
68
|
|
|
@test_visit ||= FactoryBot.create(:test_visit) |
69
|
|
|
end |
70
|
|
|
end |
71
|
|
|
|
72
|
|
|
# Factory to create or return instrument related test objects |
73
|
|
|
class InstrumentTestFactory |
74
|
|
|
def self.test_instrument |
75
|
|
|
@test_instrument ||= |
76
|
|
|
Instrument.find_by(name: TestConstants::TEST_INSTRUMENT) |
77
|
|
|
end |
78
|
|
|
|
79
|
|
|
def self.test_response_scale |
80
|
|
|
@test_response_scale ||= FactoryBot.create(:test_response_scale) |
81
|
|
|
end |
82
|
|
|
end |
83
|
|
|
|
84
|
|
|
# Factory to create or return project related test objects |
85
|
|
|
class ProjectTestFactory |
86
|
|
|
def self.test_folder |
87
|
|
|
@test_folder ||= FactoryBot.create(:test_folder) |
88
|
|
|
end |
89
|
|
|
|
90
|
|
|
def self.test_project |
91
|
|
|
@test_project ||= FactoryBot.create(:test_project) |
92
|
|
|
end |
93
|
|
|
end |
94
|
|
|
|