Sha256: dfd01c2b4ed2b2f952752893698a3434302241514c005b57e9a933d3b6a396e9

Contents?: true

Size: 891 Bytes

Versions: 1

Compression:

Stored size: 891 Bytes

Contents

require 'spec_helper'

def sasl_error_node(err_name = 'aborted')
  node = Blather::XMPPNode.new 'failure'
  node.namespace = Blather::SASLError::SASL_ERR_NS

  node << Blather::XMPPNode.new(err_name, node.document)
  node
end

describe Blather::SASLError do
  it 'can import a node' do
    expect(Blather::SASLError).to respond_to :import
    e = Blather::SASLError.import sasl_error_node
    expect(e).to be_kind_of Blather::SASLError
  end

  describe 'each XMPP SASL error type' do
    %w[ aborted
        incorrect-encoding
        invalid-authzid
        invalid-mechanism
        mechanism-too-weak
        not-authorized
        temporary-auth-failure
    ].each do |error_type|
      it "handles the name for #{error_type}" do
        e = Blather::SASLError.import sasl_error_node(error_type)
        expect(e.name).to eq(error_type.gsub('-','_').to_sym)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blather-2.0.0 spec/blather/errors/sasl_error_spec.rb