Sha256: 761ebacc0f76c05bf086c5eed9272d71e1389974936e487ee4bc0f9dc8f6d940

Contents?: true

Size: 742 Bytes

Versions: 8

Compression:

Stored size: 742 Bytes

Contents

require 'spec_helper'

describe Xmldsig::Transforms::EnvelopedSignature do
  let(:unsigned_xml) { File.read('spec/fixtures/unsigned_nested_signature.xml') }
  let(:unsigned_document) { Xmldsig::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::NAMESPACES)
    remaining_signatures.count.should == 1
    signature = Xmldsig::Signature.new(remaining_signatures.first)

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

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
xmldsig-0.2.7 spec/lib/xmldsig/transforms/enveloped_signature_spec.rb
xmldsig-0.2.6 spec/lib/xmldsig/transforms/enveloped_signature_spec.rb
xmldsig-0.2.5 spec/lib/xmldsig/transforms/enveloped_signature_spec.rb
xmldsig-fiscalizer-0.2.4 spec/lib/xmldsig/transforms/enveloped_signature_spec.rb
xmldsig-0.2.4 spec/lib/xmldsig/transforms/enveloped_signature_spec.rb
xmldsig-0.2.3 spec/lib/xmldsig/transforms/enveloped_signature_spec.rb
xmldsig-0.2.2 spec/lib/xmldsig/transforms/enveloped_signature_spec.rb
xmldsig-0.2.1 spec/lib/xmldsig/transforms/enveloped_signature_spec.rb