Sha256: 687e52bed25beb45374bfbf8ddeb0b094640b3d4dfb5dac2417c621ad2f1cec5

Contents?: true

Size: 1019 Bytes

Versions: 2

Compression:

Stored size: 1019 Bytes

Contents

require File.join(File.dirname(__FILE__), *%w[.. .. .. spec_helper])

describe 'Blather::Stanza::Iq::Query' do
  it 'registers itself' do
    XMPPNode.class_from_registration(:query, nil).must_equal Stanza::Iq::Query
  end

  it 'ensures a query node is present on create' do
    query = Stanza::Iq::Query.new
    query.children.detect { |n| n.element_name == 'query' }.wont_be_nil
  end

  it 'ensures a query node exists when calling #query' do
    query = Stanza::Iq::Query.new
    query.remove_child :query
    query.children.detect { |n| n.element_name == 'query' }.must_be_nil

    query.query.wont_be_nil
    query.children.detect { |n| n.element_name == 'query' }.wont_be_nil
  end

  it 'sets type to "reslut" on reply' do
    query = Stanza::Iq::Query.new
    query.type.must_equal :get
    reply = query.reply.type.must_equal :result
  end

  it 'sets type to "reslut" on reply!' do
    query = Stanza::Iq::Query.new
    query.type.must_equal :get
    query.reply!
    query.type.must_equal :result
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
blather-0.2.1 spec/blather/stanza/iq/query_spec.rb
blather-0.2 spec/blather/stanza/iq/query_spec.rb