Method: Ccls::FactoryTestHelper#create_study_subjects_with_recruitment_priorities

Defined in:
lib/ccls_engine/factory_test_helper.rb

#create_study_subjects_with_recruitment_priorities(*priorities) ⇒ Object



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/ccls_engine/factory_test_helper.rb', line 81

def create_study_subjects_with_recruitment_priorities(*priorities)
  project = nil
  assert_difference('Project.count',1) {
    project = Factory(:project)
  }
  study_subjects = priorities.collect do |priority|
    study_subject = nil
    assert_difference('Enrollment.count',1){  #  auto-created ccls enrollment
    assert_difference('StudySubject.count',1) {
      study_subject = create_study_subject
    } }
    assert_difference('Enrollment.count',1){
      Factory(:enrollment, :project => project, 
        :study_subject => study_subject,
        :recruitment_priority => priority)
    }
    study_subject
  end
  return [project,*study_subjects]
end