Sha256: 44b7a4c51027b032790c0efb7784e5218c425a38cd81344f8de6f52fed05eecd

Contents?: true

Size: 919 Bytes

Versions: 22

Compression:

Stored size: 919 Bytes

Contents

require File.join(File.dirname(__FILE__), *%w[.. .. 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
    Blather::SASLError.must_respond_to :import
    e = Blather::SASLError.import sasl_error_node
    e.must_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)
        e.name.must_equal error_type.gsub('-','_').to_sym
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 3 rubygems

Version Path
blather-0.4.1 spec/blather/errors/sasl_error_spec.rb
blather-0.4.0 spec/blather/errors/sasl_error_spec.rb