Sha256: e97fb62a15a2c5e8ee737667aa30a35f71e05c72faec1cb995b5599b2d664e58

Contents?: true

Size: 1.37 KB

Versions: 24

Compression:

Stored size: 1.37 KB

Contents

require File.join(File.dirname(__FILE__), '..', '..', 'lib', 'flapjack', 'notifiers', 'xmpp', 'init')
require File.join(File.dirname(__FILE__), '..', 'helpers')

describe "xmpp notifier" do 

  it "should error if no login details provided" do 
    lambda {
      xmpp = Flapjack::Notifiers::Xmpp.new
    }.should raise_error(ArgumentError)
  end

  it "should error if no recipient is provided" do
    xmpp = Flapjack::Notifiers::Xmpp.new(:jid => "5b73a016c5c644e9bf1601a241fc27f5@jabber.org", :password => "5b73a016c5c644e9bf1601a241fc27f5")
    lambda {
      xmpp.notify(:result => 'foo')
    }.should raise_error(ArgumentError, /recipient/)
  end

  it "should error if no result is provided" do
    xmpp = Flapjack::Notifiers::Xmpp.new(:jid => "5b73a016c5c644e9bf1601a241fc27f5@jabber.org", :password => "5b73a016c5c644e9bf1601a241fc27f5")
    lambda {
      xmpp.notify(:who => 'foo')
    }.should raise_error(ArgumentError, /result/)
  end

  it "should deliver message to a recipient" do 
    xmpp = Flapjack::Notifiers::Xmpp.new(:jid => "5b73a016c5c644e9bf1601a241fc27f5@jabber.org", :password => "5b73a016c5c644e9bf1601a241fc27f5")
    lambda {
      response = xmpp.notify(:who => OpenStruct.new(:jid => "5b73a016c5c644e9bf1601a241fc27f5@jabber.org"), 
                             :result => OpenStruct.new(:id => 11, :status => 2, :output => "foo"))
    }.should_not raise_error
  end

end


Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
flapjack-0.6.43 spec.old/notifiers/xmpp_spec.rb
flapjack-0.6.42 spec.old/notifiers/xmpp_spec.rb
flapjack-0.6.41 spec.old/notifiers/xmpp_spec.rb
flapjack-0.6.40 spec.old/notifiers/xmpp_spec.rb
flapjack-0.6.39 spec.old/notifiers/xmpp_spec.rb
flapjack-0.6.38 spec.old/notifiers/xmpp_spec.rb
flapjack-0.6.37 spec.old/notifiers/xmpp_spec.rb
flapjack-0.6.36 spec.old/notifiers/xmpp_spec.rb
flapjack-0.6.35 spec.old/notifiers/xmpp_spec.rb
flapjack-0.6.34 spec.old/notifiers/xmpp_spec.rb
flapjack-0.6.33 spec.old/notifiers/xmpp_spec.rb
flapjack-0.6.32 spec.old/notifiers/xmpp_spec.rb
flapjack-0.6.31 spec.old/notifiers/xmpp_spec.rb
flapjack-0.6.30 spec.old/notifiers/xmpp_spec.rb
flapjack-0.6.29 spec.old/notifiers/xmpp_spec.rb
flapjack-0.6.28 spec.old/notifiers/xmpp_spec.rb
flapjack-0.6.27 spec.old/notifiers/xmpp_spec.rb
flapjack-0.6.26 spec.old/notifiers/xmpp_spec.rb
flapjack-0.6.25 spec.old/notifiers/xmpp_spec.rb
flapjack-0.6.24 spec.old/notifiers/xmpp_spec.rb