TestFactory   A
last analyzed

Complexity

Total Complexity 16

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Importance

Changes 16
Bugs 1 Features 2
Metric Value
c 16
b 1
f 2
dl 0
loc 65
rs 10
wmc 16

16 Methods

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