Class: RSpec::RSpecOscalFormatter::CreateAssessmentPlan

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec_oscal_formatter/create_assessment_plan.rb

Overview

Create an assessment plan from the metadata and template

Instance Method Summary collapse

Constructor Details

#initialize(metadata) ⇒ CreateAssessmentPlan

Returns a new instance of CreateAssessmentPlan.



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rspec_oscal_formatter/create_assessment_plan.rb', line 10

def initialize()
  @assessment_plan =
    Oscal::AssessmentPlan::AssessmentPlan.new(
      {
        uuid: .assessment_plan_uuid,
        metadata: (),
        import_ssp: { href: './assessment_plan.json' },
        reviewed_controls: make_reviewed_controls(),
      },
    )
end

Instance Method Details

#build_ap_metadata_block(metadata) ⇒ Object



22
23
24
25
26
27
28
29
# File 'lib/rspec_oscal_formatter/create_assessment_plan.rb', line 22

def ()
  {
    title: "Automated Testing Plan for login.gov. It #{.description}",
    last_modified: DateTime.now.iso8601,
    version: DateTime.now.iso8601,
    oscal_version: '1.1.2',
  }
end

#getObject



44
45
46
# File 'lib/rspec_oscal_formatter/create_assessment_plan.rb', line 44

def get
  @assessment_plan
end

#make_reviewed_controls(metadata) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/rspec_oscal_formatter/create_assessment_plan.rb', line 31

def make_reviewed_controls()
  {
    control_selections: [
      include_controls: [
        {
          control_id: .control_id,
          statement_ids: [.statement_id],
        },
      ],
    ],
  }
end

#to_json(*_args) ⇒ Object



48
49
50
# File 'lib/rspec_oscal_formatter/create_assessment_plan.rb', line 48

def to_json(*_args)
  @assessment_plan.to_json
end