Sha256: bb07980db08433e457bbd2fdc923b6fd906f6b7911116cfa05e513cf20a8a154

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe CXML::Credential do
  it { should respond_to :domain }
  it { should respond_to :type }
  it { should respond_to :shared_secret }
  it { should respond_to :credential_mac }
  it { should respond_to :identity }

  let(:parser) { CXML::Parser.new }
  let(:data) { parser.parse(fixture('punch_out_order_message_doc.xml')) }
  let(:doc) { CXML::Document.new(data) }
  let(:sender) { doc.header.sender }
  let(:credential) { sender.credential }
  let(:builder) { doc.render }

  describe '#initialize' do
    it 'sets the attributes that are passed' do
      credential.shared_secret.should_not be_nil
      credential.identity.should_not be_nil
    end
  end

  describe '#render' do
    let(:output_xml) { builder.to_xml }
    let(:output_data) { parser.parse(output_xml) }
    let(:sender_output_data) { output_data[:header][:sender] }
    let(:credential_output_data) { sender_output_data[:credential] }

    it 'contains the required nodes' do
      credential_output_data[:shared_secret].should_not be_empty
      credential_output_data[:identity].should_not be_empty
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cxml-ruby-0.2.1 spec/credential_spec.rb
cxml-ruby-0.2.0 spec/credential_spec.rb