Class: UatActions::GenerateProject

Inherits:
UatActions show all
Defined in:
app/uat_actions/uat_actions/generate_project.rb

Overview

Will construct a project

Constant Summary

Constants inherited from UatActions

CATEGORY_LIST

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from UatActions

all, category, find, form_field, form_fields, #form_fields, grouped_and_sorted_uat_actions, id, inherited, permitted, #report, #save, to_partial_path, uat_actions

Class Method Details

.defaultObject



13
14
15
# File 'app/uat_actions/uat_actions/generate_project.rb', line 13

def self.default
  new(project_name: UatActions::StaticRecords.project.name, project_cost_code: '1234')
end

Instance Method Details

#create_projectObject



24
25
26
27
28
29
30
31
32
33
# File 'app/uat_actions/uat_actions/generate_project.rb', line 24

def create_project
  Project.create_with(
    approved: true,
    state: 'active',
    project_metadata_attributes: {
      project_cost_code: project_cost_code,
      project_funding_model: 'Internal'
    }
  ).find_or_create_by!(name: project_name)
end

#performObject



17
18
19
20
21
22
# File 'app/uat_actions/uat_actions/generate_project.rb', line 17

def perform
  project = create_project
  print_report(project)

  true
end