Sha256: 9b30b466be019c23e3fc3ca170479762fc5ccfe10476e6421336b7d2ae5bab62

Contents?: true

Size: 875 Bytes

Versions: 15

Compression:

Stored size: 875 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
    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

15 entries across 15 versions & 1 rubygems

Version Path
blather-0.6.2 spec/blather/errors/sasl_error_spec.rb
blather-0.6.1 spec/blather/errors/sasl_error_spec.rb
blather-0.6.0 spec/blather/errors/sasl_error_spec.rb
blather-0.5.12 spec/blather/errors/sasl_error_spec.rb
blather-0.5.11 spec/blather/errors/sasl_error_spec.rb
blather-0.5.10 spec/blather/errors/sasl_error_spec.rb
blather-0.5.9 spec/blather/errors/sasl_error_spec.rb
blather-0.5.8 spec/blather/errors/sasl_error_spec.rb
blather-0.5.7 spec/blather/errors/sasl_error_spec.rb
blather-0.5.6 spec/blather/errors/sasl_error_spec.rb
blather-0.5.4 spec/blather/errors/sasl_error_spec.rb
blather-0.5.3 spec/blather/errors/sasl_error_spec.rb
blather-0.5.2 spec/blather/errors/sasl_error_spec.rb
blather-0.5.0 spec/blather/errors/sasl_error_spec.rb
blather-0.4.16 spec/blather/errors/sasl_error_spec.rb