Sha256: 0d63263f146ad5e56869d7d3abaad1b0ae98619ffed4df7a1032a207db049719

Contents?: true

Size: 1.17 KB

Versions: 11

Compression:

Stored size: 1.17 KB

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

  [:get, :set, :result, :error].each do |type|
    it "can be set as \"#{type}\"" do
      query = Stanza::Iq::Query.new type
      query.type.must_equal type
    end
  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

11 entries across 11 versions & 2 rubygems

Version Path
sprsquish-blather-0.3.0 spec/blather/stanza/iq/query_spec.rb
sprsquish-blather-0.3.1 spec/blather/stanza/iq/query_spec.rb
sprsquish-blather-0.3.2 spec/blather/stanza/iq/query_spec.rb
sprsquish-blather-0.3.3 spec/blather/stanza/iq/query_spec.rb
sprsquish-blather-0.3.4 spec/blather/stanza/iq/query_spec.rb
blather-0.2.2 spec/blather/stanza/iq/query_spec.rb
blather-0.3.1 spec/blather/stanza/iq/query_spec.rb
blather-0.3.0 spec/blather/stanza/iq/query_spec.rb
blather-0.3.3 spec/blather/stanza/iq/query_spec.rb
blather-0.3.2 spec/blather/stanza/iq/query_spec.rb
blather-0.3.4 spec/blather/stanza/iq/query_spec.rb