Sha256: 0c06fa1375b9c1716911658bf21f1bc6e2ac34400406b27c4635192ac35fe559

Contents?: true

Size: 748 Bytes

Versions: 12

Compression:

Stored size: 748 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 outer most signature element' do
    node_with_nested_signature = unsigned_document.signatures.first.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

12 entries across 12 versions & 1 rubygems

Version Path
xmldsig-0.6.2 spec/lib/xmldsig/transforms/enveloped_signature_spec.rb
xmldsig-0.6.1 spec/lib/xmldsig/transforms/enveloped_signature_spec.rb
xmldsig-0.5.1 spec/lib/xmldsig/transforms/enveloped_signature_spec.rb
xmldsig-0.5.0 spec/lib/xmldsig/transforms/enveloped_signature_spec.rb
xmldsig-0.4.1 spec/lib/xmldsig/transforms/enveloped_signature_spec.rb
xmldsig-0.4.0 spec/lib/xmldsig/transforms/enveloped_signature_spec.rb
xmldsig-0.3.2 spec/lib/xmldsig/transforms/enveloped_signature_spec.rb
xmldsig-0.3.1 spec/lib/xmldsig/transforms/enveloped_signature_spec.rb
xmldsig-0.3.0 spec/lib/xmldsig/transforms/enveloped_signature_spec.rb
xmldsig-0.2.10 spec/lib/xmldsig/transforms/enveloped_signature_spec.rb
xmldsig-0.2.9 spec/lib/xmldsig/transforms/enveloped_signature_spec.rb
xmldsig-0.2.8 spec/lib/xmldsig/transforms/enveloped_signature_spec.rb