Sha256: 323c85da57dfa5424aeaeccc9152468d48651b271829862b56c34b9d0a34d746

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 "result" 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 "result" 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 & 2 rubygems

Version Path
sprsquish-blather-0.2.3 spec/blather/stanza/iq/query_spec.rb
blather-0.2.3 spec/blather/stanza/iq/query_spec.rb