Sha256: af61f8b28e9e316de90e56b2ddb6d99a1253ced66b654d567e3ec0f09c6a5bf3

Contents?: true

Size: 786 Bytes

Versions: 1

Compression:

Stored size: 786 Bytes

Contents

require 'spec_helper'

describe Xmldsig_fiscalizer::Transforms::EnvelopedSignature do
  let(:unsigned_xml) { File.read('spec/fixtures/unsigned_nested_signature.xml') }
  let(:unsigned_document) { Xmldsig_fiscalizer::SignedDocument.new(unsigned_xml) }

  it 'only removes the first signature element' do
    node_with_nested_signature = unsigned_document.signatures.last.references.first.referenced_node

    described_class.new(node_with_nested_signature, nil).transform

    remaining_signatures = node_with_nested_signature.xpath('descendant::ds:Signature', Xmldsig_fiscalizer::NAMESPACES)
    remaining_signatures.count.should == 1
    signature = Xmldsig_fiscalizer::Signature.new(remaining_signatures.first)

    signature.references.first.reference_uri.should == '#baz'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
xmldsig-fiscalizer-0.2.5 spec/lib/xmldsig/transforms/enveloped_signature_spec.rb