Sha256: d305644b5833760c4329c39f1bcebb1b08eac2cfb9bdedb27d07d415714c4b7e

Contents?: true

Size: 1.04 KB

Versions: 11

Compression:

Stored size: 1.04 KB

Contents

require "spec_helper"

describe Xmlenc::Builder::KeyInfo do

  let(:xml) { File.read File.join("spec", "fixtures", "encrypted_document.xml") }
  subject   { described_class.parse(xml) }

  describe "#parse" do
    it "should create two KeyInfo elements" do
      subject.each do |element|
        expect(element).to be_a Xmlenc::Builder::KeyInfo
      end

      expect(subject.size).to eq 2
    end

    describe "key name" do
      it "doesn't have a key name in the first key info element" do
        expect(subject.first.key_name).to be_nil
      end

      it "should parse the key name in the second key info element" do
        expect(subject.last.key_name).to eq "my-rsa-key"
      end
    end

    describe "encrypted key" do
      it "should parse the encrypted key in the first key info element" do
        expect(subject.first.encrypted_key).to be_a Xmlenc::Builder::EncryptedKey
      end

      it "doesn't have an encrypted key in the second key info element" do
        expect(subject.last.encrypted_key).to be_nil
      end
    end
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
xmlenc-0.3.0 spec/lib/xmlenc/builder/key_info_spec.rb
xmlenc-0.2.1 spec/lib/xmlenc/builder/key_info_spec.rb
xmlenc-0.2.0 spec/lib/xmlenc/builder/key_info_spec.rb
xmlenc-0.1.7 spec/lib/xmlenc/builder/key_info_spec.rb
xmlenc-0.1.6 spec/lib/xmlenc/builder/key_info_spec.rb
xmlenc-0.1.5 spec/lib/xmlenc/builder/key_info_spec.rb
xmlenc-0.1.4 spec/lib/xmlenc/builder/key_info_spec.rb
xmlenc-0.1.3 spec/lib/xmlenc/builder/key_info_spec.rb
xmlenc-0.1.2 spec/lib/xmlenc/builder/key_info_spec.rb
xmlenc-0.1.1 spec/lib/xmlenc/builder/key_info_spec.rb
xmlenc-0.1.0 spec/lib/xmlenc/builder/key_info_spec.rb