Skip to content

Commit

Permalink
Require json library for to_json method
Browse files Browse the repository at this point in the history
  • Loading branch information
rahearn authored and ronaldtse committed Jul 10, 2024
1 parent a05431c commit 5818490
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/oscal/assembly.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require_relative "parsing_functions"
require_relative "logger"
require_relative "metadata_block"
require "json"

module Oscal
class MetadataBlockWrapper < Oscal::MetadataBlock
Expand Down Expand Up @@ -32,8 +33,8 @@ def allowed_attributes
end
end

def to_json
to_h.to_json
def to_json(*args)
to_h.to_json(*args)
end

def to_h
Expand Down
1 change: 1 addition & 0 deletions lib/oscal/serializer.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require "yaml"
require "json"

module Oscal
module Serializer
Expand Down
2 changes: 1 addition & 1 deletion spec/oscal/assessment_plan_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

describe "#to_json" do
it "generates a json representation of the assessment plan" do
expect(subject.to_json).to be_kind_of(String)
expect(subject.to_json).to eq(JSON.generate(fields))
end
end
end

0 comments on commit 5818490

Please sign in to comment.