Sha256: b66b9d3e7524d043da61be54df21dee7921d6834734d2ec1505c667f0935fb3d

Contents?: true

Size: 1 KB

Versions: 6

Compression:

Stored size: 1 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe CXML::Sender do
  it { should respond_to :credential }
  it { should respond_to :user_agent }

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

  describe '#initialize' do
    it 'sets the mandatory attributes' do
      sender.credential.should_not be_nil
      sender.user_agent.should_not be_nil
    end
  end

  describe '#render' do
    let(:output_xml) { doc.to_xml }
    let(:output_data) { CXML::Parser.new(data: output_xml).parse }
    let(:sender_output_data) { output_data[:header][:sender] }

    it 'contains the required nodes' do
      sender_output_data[:user_agent].should_not be_empty
      sender_output_data[:credential].should_not be_empty
    end

    it 'validates against the DTD' do
      next unless test_for_xmllint

      lint_doc_with_dtd(CXML::Document.new.from_xml(output_xml)).should be true
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cxml-ruby-0.8.2 spec/sender_spec.rb
cxml-ruby-0.8.1 spec/sender_spec.rb
cxml-ruby-0.8.0 spec/sender_spec.rb
cxml-ruby-0.7.0 spec/sender_spec.rb
cxml-ruby-0.6.1 spec/sender_spec.rb
cxml-ruby-0.6.0 spec/sender_spec.rb