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
- .order_role ⇒ Object
- .program ⇒ Object
- .project ⇒ Object
- .study ⇒ Object
-
.study_name ⇒ String
Returns the default study_name.
- .study_type ⇒ Object
- .supplier ⇒ Object
- .tube_purpose ⇒ Object
- .user ⇒ Object
Class Method Details
.budget_division ⇒ Object
68 69 70 |
# File 'app/uat_actions/uat_actions/static_records.rb', line 68 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
52 53 54 |
# File 'app/uat_actions/uat_actions/static_records.rb', line 52 def self.data_release_study_type DataReleaseStudyType.default || DataReleaseStudyType.find_or_create_by(name: 'UAT') end |
.faculty_sponsor ⇒ Object
85 86 87 |
# File 'app/uat_actions/uat_actions/static_records.rb', line 85 def self.faculty_sponsor FacultySponsor.find_or_create_by!(name: 'UAT Faculty Sponsor') end |
.order_role ⇒ Object
89 90 91 |
# File 'app/uat_actions/uat_actions/static_records.rb', line 89 def self.order_role OrderRole.find_or_create_by!(role: 'UAT Order Role') end |
.program ⇒ Object
72 73 74 |
# File 'app/uat_actions/uat_actions/static_records.rb', line 72 def self.program Program.find_or_create_by!(name: 'UAT') end |
.project ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 |
# File 'app/uat_actions/uat_actions/static_records.rb', line 56 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
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/uat_actions/uat_actions/static_records.rb', line 31 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_name ⇒ String
Returns the default study_name
17 18 19 |
# File 'app/uat_actions/uat_actions/static_records.rb', line 17 def self.study_name 'UAT Study' end |
.study_type ⇒ Object
48 49 50 |
# File 'app/uat_actions/uat_actions/static_records.rb', line 48 def self.study_type StudyType.create_with(valid_type: true, valid_for_creation: true).find_or_create_by!(name: 'UAT') end |
.supplier ⇒ Object
21 22 23 |
# File 'app/uat_actions/uat_actions/static_records.rb', line 21 def self.supplier Supplier.find_or_create_by!(name: 'UAT Supplier') end |
.tube_purpose ⇒ Object
25 26 27 28 29 |
# File 'app/uat_actions/uat_actions/static_records.rb', line 25 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
76 77 78 79 80 81 82 83 |
# File 'app/uat_actions/uat_actions/static_records.rb', line 76 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 |