-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework spec to better comply with Codacy style rules.
Signed-off-by: Kyle Hammond <[email protected]>
- Loading branch information
Showing
1 changed file
with
51 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -276,6 +276,47 @@ | |
'pkg:cocoapods/[email protected]' => [] | ||
} | ||
end | ||
# Important: these expected components are sorted alphabetically | ||
let(:pod_result) do | ||
'<components> | ||
<component type="library"> | ||
<name>Alamofire</name> | ||
<version>5.6.2</version> | ||
<purl>pkg:cocoapods/[email protected]</purl> | ||
<bomRef>pkg:cocoapods/[email protected]</bomRef> | ||
</component> | ||
<component type="library"> | ||
<name>FirebaseAnalytics</name> | ||
<version>7.10.0</version> | ||
<purl>pkg:cocoapods/[email protected]</purl> | ||
<bomRef>pkg:cocoapods/[email protected]</bomRef> | ||
</component> | ||
<component type="library"> | ||
<name>MSAL</name> | ||
<version>1.2.1</version> | ||
<purl>pkg:cocoapods/[email protected]</purl> | ||
<bomRef>pkg:cocoapods/[email protected]</bomRef> | ||
</component> | ||
<component type="library"> | ||
<name>MSAL/app-lib</name> | ||
<version>1.2.1</version> | ||
<purl>pkg:cocoapods/[email protected]#app-lib</purl> | ||
<bomRef>pkg:cocoapods/[email protected]#app-lib</bomRef> | ||
</component> | ||
<component type="library"> | ||
<name>Realm</name> | ||
<version>5.5.1</version> | ||
<purl>pkg:cocoapods/[email protected]</purl> | ||
<bomRef>pkg:cocoapods/[email protected]</bomRef> | ||
</component> | ||
<component type="library"> | ||
<name>RxSwift</name> | ||
<version>5.1.2</version> | ||
<purl>pkg:cocoapods/[email protected]</purl> | ||
<bomRef>pkg:cocoapods/[email protected]</bomRef> | ||
</component> | ||
</components>' | ||
end | ||
|
||
shared_examples 'bom_generator' do | ||
context 'with an incorrect version' do | ||
|
@@ -362,64 +403,25 @@ | |
end | ||
|
||
it 'should properly delegate component node generation to pods' do | ||
components_generated_from_bom_builder = xml.at('bom/components') | ||
|
||
# Important: these expected components are sorted alphabetically | ||
expected_components_string = | ||
'<components> | ||
<component type="library"> | ||
<name>Alamofire</name> | ||
<version>5.6.2</version> | ||
<purl>pkg:cocoapods/[email protected]</purl> | ||
<bomRef>pkg:cocoapods/[email protected]</bomRef> | ||
</component> | ||
<component type="library"> | ||
<name>FirebaseAnalytics</name> | ||
<version>7.10.0</version> | ||
<purl>pkg:cocoapods/[email protected]</purl> | ||
<bomRef>pkg:cocoapods/[email protected]</bomRef> | ||
</component> | ||
<component type="library"> | ||
<name>MSAL</name> | ||
<version>1.2.1</version> | ||
<purl>pkg:cocoapods/[email protected]</purl> | ||
<bomRef>pkg:cocoapods/[email protected]</bomRef> | ||
</component> | ||
<component type="library"> | ||
<name>MSAL/app-lib</name> | ||
<version>1.2.1</version> | ||
<purl>pkg:cocoapods/[email protected]#app-lib</purl> | ||
<bomRef>pkg:cocoapods/[email protected]#app-lib</bomRef> | ||
</component> | ||
<component type="library"> | ||
<name>Realm</name> | ||
<version>5.5.1</version> | ||
<purl>pkg:cocoapods/[email protected]</purl> | ||
<bomRef>pkg:cocoapods/[email protected]</bomRef> | ||
</component> | ||
<component type="library"> | ||
<name>RxSwift</name> | ||
<version>5.1.2</version> | ||
<purl>pkg:cocoapods/[email protected]</purl> | ||
<bomRef>pkg:cocoapods/[email protected]</bomRef> | ||
</component> | ||
</components>' | ||
|
||
components = Nokogiri::XML expected_components_string | ||
|
||
expect(components_generated_from_bom_builder.to_xml).to be_equivalent_to(components.root.to_xml).respecting_element_order | ||
actual = xml.at('bom/components').to_xml | ||
|
||
expected = Nokogiri::XML pod_result | ||
expected = expected.root.to_xml | ||
|
||
expect(actual).to be_equivalent_to(expected).respecting_element_order | ||
end | ||
|
||
it 'should generate a child dependencies node' do | ||
expect(xml.at('bom/dependencies')).not_to be_nil | ||
end | ||
|
||
it 'should properly set dependencies node' do | ||
dependencies_generated_from_bom_builder = xml.at('bom/dependencies') | ||
actual = xml.at('bom/dependencies').to_xml | ||
|
||
dependencies = Nokogiri::XML dependencies_result | ||
expected = Nokogiri::XML dependencies_result | ||
expected = expected.root.to_xml | ||
|
||
expect(dependencies_generated_from_bom_builder.to_xml).to be_equivalent_to(dependencies.root.to_xml).respecting_element_order | ||
expect(actual).to be_equivalent_to(expected).respecting_element_order | ||
end | ||
end | ||
end | ||
|