Test Setup Failed
Push — master ( a82c68...32b7b8 )
by Steven
01:27
created

TestFactory.test_choice()   A

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
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_hipaa_identifier
23
    @test_hipaa_identifier ||= FactoryBot.create(:test_hipaa_identifier)
24
  end 
25
  
26
  def self.test_participant
27
    @test_participant ||= FactoryBot.create(:test_participant)
28
  end
29
30
  def self.test_schedule
31
    @test_schedule ||= FactoryBot.create(:test_schedule)
32
  end 
33
 
34
  def self.test_study
35
    @test_study ||= FactoryBot.create(:test_study)
36
  end
37
38
  def self.test_study_event
39
    @test_study_event ||= FactoryBot.create(:test_study_event)
40
  end 
41
  
42
  def self.test_study_participant
43
    @test_study_participant ||= FactoryBot.create(:test_study_participant)
44
  end 
45
46
  def self.test_survey_participant
47
    @test_survey_participant ||= FactoryBot.create(:test_survey_participant)
48
  end 
49
    
50
  def self.test_study_event_instrument
51
    @test_study_event_instrument ||= 
52
      FactoryBot.create(:test_study_event_instrument)
53
  end
54
55
  def self.test_journal
56
    @test_journal ||= FactoryBot.create(:test_journal)
57
  end
58
59
  def self.test_journal_entry
60
    @test_journal_entry ||= FactoryBot.create(:test_journal_entry)
61
  end
62
63
  def self.test_survey
64
    @test_survey ||= FactoryBot.create(:test_survey)
65
  end
66
67
  def self.test_user
68
    @test_user ||= FactoryBot.create(:test_user)
69
  end
70
71
  def self.test_visit
72
    @test_visit ||= FactoryBot.create(:test_visit)
73
  end
74
end
75
76
# Factory to create or return instrument related test objects
77
class InstrumentTestFactory
78
  def self.test_instrument
79
    @test_instrument ||= 
80
      Instrument.find_by(name: TestConstants::TEST_INSTRUMENT) 
81
  end
82
  
83
  def self.test_response_scale
84
    @test_response_scale ||= FactoryBot.create(:test_response_scale)
85
  end 
86
end
87
88
# Factory to create or return project related test objects
89
class ProjectTestFactory
90
  def self.test_folder
91
    @test_folder ||= FactoryBot.create(:test_folder)
92
  end
93
  
94
  def self.test_project
95
    @test_project ||= FactoryBot.create(:test_project)
96
  end
97
end
98