Skip to content

Commit

Permalink
style: fix codacy warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Jeremy Long <[email protected]>
  • Loading branch information
jeremylong committed Dec 21, 2024
1 parent b76e3e9 commit bc2789d
Showing 1 changed file with 18 additions and 19 deletions.
37 changes: 18 additions & 19 deletions spec/cyclonedx/cocoapods/bom_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,6 @@
end
end


context 'when generating a pod component in a BOM for JSON' do
it 'should generate a root component of type library' do
expect(xml.at('/component')).not_to be_nil
Expand Down Expand Up @@ -513,7 +512,6 @@
end
end
end

end

RSpec.describe CycloneDX::CocoaPods::Pod::License do
Expand All @@ -526,7 +524,7 @@
end.to_xml)
end
let(:json) do
license.to_json_component()
license.to_json_component
end

it 'should generate a root license element' do
Expand Down Expand Up @@ -624,7 +622,7 @@
Nokogiri::XML(Nokogiri::XML::Builder.new(encoding: 'UTF-8') { |xml| component.add_to_bom(xml) }.to_xml)
end
let(:json) do
component.to_json_component()
component.to_json_component
end

it_behaves_like 'component'
Expand Down Expand Up @@ -822,7 +820,7 @@
Nokogiri::XML(Nokogiri::XML::Builder.new(encoding: 'UTF-8') { |xml| manufacturer.add_to_bom(xml) }.to_xml)
end
let(:json) do
manufacturer.to_json_manufacturer()
manufacturer.to_json_manufacturer
end
it_behaves_like 'manufacturer'

Expand Down Expand Up @@ -875,7 +873,7 @@
RSpec.describe CycloneDX::CocoaPods::BOMBuilder do
context 'when generating a BOM' do
# Important: these pods are NOT in alphabetical order; they will be sorted in output
let(:pods) do
let(:pods) do
{
'Alamofire' => '5.6.2',
'FirebaseAnalytics' => '7.10.0',
Expand Down Expand Up @@ -1323,7 +1321,7 @@
end

context 'when generating a JSON BOM' do
let(:pods) do
let(:pods) do
{
'Alamofire' => '5.6.2',
'FirebaseAnalytics' => '7.10.0',
Expand Down Expand Up @@ -1363,24 +1361,25 @@
it 'should properly generate pod components' do
expect(bom_json[:components].length).to eq(pods.length)
expect(bom_json[:components].first).to include(
type: 'library',
name: 'Alamofire',
version: '5.6.2',
author: 'Chewbacca',
publisher: 'Chewbacca',
purl: 'pkg:cocoapods/[email protected]'
)
type: 'library',
name: 'Alamofire',
version: '5.6.2',
author: 'Chewbacca',
publisher: 'Chewbacca',
purl: 'pkg:cocoapods/[email protected]'
)
end

context 'when asked to shorten strings' do
let(:short_json) { JSON.parse(bom_builder.bom(version: version, format: :json, trim_strings_length: 6), symbolize_names: true) }
let(:short_json) { JSON.parse(bom_builder.bom(version: version, format: :json, trim_strings_length: 6),
symbolize_names: true) }

it 'should properly trim the author, publisher, and purl' do
expect(short_json[:components].first).to include(
author: 'Chewba',
publisher: 'Chewba',
purl: 'pkg:cocoapods/[email protected]'
)
author: 'Chewba',
publisher: 'Chewba',
purl: 'pkg:cocoapods/[email protected]'
)
end
end

Expand Down

0 comments on commit bc2789d

Please sign in to comment.