diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-26 18:10:10 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-26 18:10:10 +0300 |
commit | c86ec1d072338034a312bb4be0ff175892fa01b7 (patch) | |
tree | e67bb3ce9beb174a20991e53d998f59adc35f02e /spec/support/shared_examples | |
parent | c15582526dd15f5ea8fac0906624cc5cd2db03ab (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/shared_examples')
-rw-r--r-- | spec/support/shared_examples/services/base_rpm_service_shared_examples.rb | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/spec/support/shared_examples/services/base_rpm_service_shared_examples.rb b/spec/support/shared_examples/services/base_rpm_service_shared_examples.rb deleted file mode 100644 index c9520852a5b..00000000000 --- a/spec/support/shared_examples/services/base_rpm_service_shared_examples.rb +++ /dev/null @@ -1,52 +0,0 @@ -# frozen_string_literal: true - -RSpec.shared_examples 'handling rpm xml file' do - include_context 'with rpm package data' - - let(:xml) { nil } - let(:data) { {} } - - context 'when generate empty xml' do - it 'generate expected xml' do - expect(subject).to eq(empty_xml) - end - end - - context 'when updating existing xml' do - let(:xml) { empty_xml } - let(:data) { xml_update_params } - - shared_examples 'changing root tag attribute' do - it "increment previous 'packages' value by 1" do - previous_value = Nokogiri::XML(xml).at(described_class::ROOT_TAG).attributes["packages"].value.to_i - new_value = Nokogiri::XML(subject).at(described_class::ROOT_TAG).attributes["packages"].value.to_i - - expect(previous_value + 1).to eq(new_value) - end - end - - it 'generate valid xml add expected xml node to existing xml' do - # Have one root attribute - result = Nokogiri::XML::Document.parse(subject).remove_namespaces! - expect(result.children.count).to eq(1) - - # Root node has 1 child with generated node - expect(result.xpath("//#{described_class::ROOT_TAG}/package").count).to eq(1) - end - - context 'when empty xml' do - it_behaves_like 'changing root tag attribute' - end - - context 'when xml has children' do - let(:xml) { described_class.new(xml: empty_xml, data: data).execute } - - it 'has children nodes' do - result = Nokogiri::XML::Document.parse(xml).remove_namespaces! - expect(result.children.count).to be > 0 - end - - it_behaves_like 'changing root tag attribute' - end - end -end |