Sha256: 693181e814ebcd1fb4a7dc52bc86e742833c16065f0948f6ba1cc624b365af0e

Contents?: true

Size: 1.19 KB

Versions: 15

Compression:

Stored size: 1.19 KB

Contents

require "spec_helper"

describe Xmlenc::Builder::EncryptionMethod do

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

  describe "required fields" do
    it "should have the algorithm field" do
      expect(subject).to respond_to :algorithm
    end

    it "should check the presence of algorithm" do
      subject.algorithm = nil
      expect(subject).to_not be_valid
      expect(subject.errors[:algorithm].size).to eq(1)
    end
  end

  describe "#parse" do
    it "should create an EncryptionMethod" do
      expect(subject).to be_a Xmlenc::Builder::EncryptionMethod
    end

    it "should parse the algorithm" do
      expect(subject.algorithm).to eq "http://www.w3.org/2001/04/xmlenc#aes128-cbc"
    end
  end

  describe "#digest_method" do
    subject { described_class.new() }

    it 'has an empty digest_method' do
      expect(subject.digest_method).to eq nil
    end

    context "digest_method_algorithm given" do
      subject { described_class.new(digest_method_algorithm: 'ALGO') }

      it 'has no empty digest_method' do
        expect(subject.digest_method).not_to eq nil
      end
    end
  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
xmlenc-0.8.0 spec/lib/xmlenc/builder/encryption_method_spec.rb
xmlenc-0.7.1 spec/lib/xmlenc/builder/encryption_method_spec.rb
xmlenc-0.7.0 spec/lib/xmlenc/builder/encryption_method_spec.rb
xmlenc-0.6.9 spec/lib/xmlenc/builder/encryption_method_spec.rb
xmlenc-0.6.8 spec/lib/xmlenc/builder/encryption_method_spec.rb
xmlenc-0.6.6 spec/lib/xmlenc/builder/encryption_method_spec.rb
xmlenc-0.6.5 spec/lib/xmlenc/builder/encryption_method_spec.rb
xmlenc-0.6.4 spec/lib/xmlenc/builder/encryption_method_spec.rb
xmlenc-0.6.3 spec/lib/xmlenc/builder/encryption_method_spec.rb
xmlenc-0.6.2 spec/lib/xmlenc/builder/encryption_method_spec.rb
xmlenc-0.6.1 spec/lib/xmlenc/builder/encryption_method_spec.rb
xmlenc-0.6.0 spec/lib/xmlenc/builder/encryption_method_spec.rb
xmlenc-0.5.0 spec/lib/xmlenc/builder/encryption_method_spec.rb
xmlenc-0.4.1 spec/lib/xmlenc/builder/encryption_method_spec.rb
xmlenc-0.4.0 spec/lib/xmlenc/builder/encryption_method_spec.rb