Module: UatActions::StaticRecords
- Defined in:
- app/uat_actions/uat_actions/static_records.rb
Overview
Provides simple consistent records where multiple records are not needed.
Constant Summary collapse
- SWIPECARD_CODE =
Swipecard code of the test user. It gets hashed when persisted to the database, so we store it as a constant here to allow us to access it in the integration suite tools.
'__uat_test__'
Class Method Summary collapse
- .budget_division ⇒ Object
- .collection_site ⇒ Object
- .data_release_study_type ⇒ Object
- .faculty_sponsor ⇒ Object
- .program ⇒ Object
- .project ⇒ Object
- .study ⇒ Object
- .study_type ⇒ Object
- .supplier ⇒ Object
- .tube_purpose ⇒ Object
- .user ⇒ Object
Class Method Details
.budget_division ⇒ Object
61 62 63 |
# File 'app/uat_actions/uat_actions/static_records.rb', line 61 def self.budget_division BudgetDivision.find_or_create_by!(name: 'UAT TESTING') end |
.collection_site ⇒ Object
10 11 12 |
# File 'app/uat_actions/uat_actions/static_records.rb', line 10 def self.collection_site 'Sanger' end |
.data_release_study_type ⇒ Object
45 46 47 |
# File 'app/uat_actions/uat_actions/static_records.rb', line 45 def self.data_release_study_type DataReleaseStudyType.default || DataReleaseStudyType.find_or_create_by(name: 'UAT') end |
.faculty_sponsor ⇒ Object
78 79 80 |
# File 'app/uat_actions/uat_actions/static_records.rb', line 78 def self.faculty_sponsor FacultySponsor.find_or_create_by!(name: 'UAT Faculty Sponsor') end |
.program ⇒ Object
65 66 67 |
# File 'app/uat_actions/uat_actions/static_records.rb', line 65 def self.program Program.find_or_create_by!(name: 'UAT') end |
.project ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 |
# File 'app/uat_actions/uat_actions/static_records.rb', line 49 def self.project Project.create_with( approved: true, state: 'active', project_metadata_attributes: { project_cost_code: 'FAKE1', project_funding_model: 'Internal', budget_division: budget_division } ).find_or_create_by!(name: 'UAT Project') end |
.study ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/uat_actions/uat_actions/static_records.rb', line 24 def self.study Study.create_with( state: 'active', study_metadata_attributes: { data_access_group: 'dag', study_type: study_type, faculty_sponsor: faculty_sponsor, data_release_study_type: data_release_study_type, study_description: 'A study generated for UAT', contaminated_human_dna: 'No', contains_human_dna: 'No', commercially_available: 'No', program: program } ).find_or_create_by!(name: 'UAT Study') end |
.study_type ⇒ Object
41 42 43 |
# File 'app/uat_actions/uat_actions/static_records.rb', line 41 def self.study_type StudyType.create_with(valid_type: true, valid_for_creation: true).find_or_create_by!(name: 'UAT') end |
.supplier ⇒ Object
14 15 16 |
# File 'app/uat_actions/uat_actions/static_records.rb', line 14 def self.supplier Supplier.find_or_create_by!(name: 'UAT Supplier') end |
.tube_purpose ⇒ Object
18 19 20 21 22 |
# File 'app/uat_actions/uat_actions/static_records.rb', line 18 def self.tube_purpose Purpose.create_with(target_type: 'SampleTube', type: 'Tube::Purpose', asset_shape_id: 1).find_or_create_by!( name: 'LCA Blood Vac' ) end |
.user ⇒ Object
69 70 71 72 73 74 75 76 |
# File 'app/uat_actions/uat_actions/static_records.rb', line 69 def self.user User.create_with( email: configatron.admin_email, first_name: 'Test', last_name: 'User', swipecard_code: SWIPECARD_CODE ).find_or_create_by(login: '__uat_test__') end |