Sha256: 551dfafb6927fdbf42d1521eeff313a973b59d7c2a4b95475fde340784b141c6

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

require 'rubygems'
require 'spec'
require 'set'

$: << File.dirname(__FILE__)
$: << File.join(File.dirname(__FILE__),'../lib')

# Loads uppercut and jabber
require 'uppercut'

# Unloads jabber, replacing it with a stub
require 'jabber_stub'

class TestAgent < Uppercut::Agent
  command 'hi' do |c,args|
    c.instance_eval { @base.instance_eval { @called_hi = true } }
    c.send 'called hi'
  end
  
  command /^hi/ do |c,args|
    c.instance_eval { @base.instance_eval { @called_hi_regex = true } }
    c.send 'called high regex'
  end
  
  command /(good)?bye/ do |c,args|
    @called_goodbye = true
    c.send args.first ? "Good bye to you as well!" : "Rot!"
  end
  
  command 'wait' do |c,args|
    @called_wait = true
    c.send 'Waiting...'
    c.wait_for do |reply|
      @called_wait_block = true
      c.send 'Hooray!'
    end
  end

  Uppercut::Agent::VALID_CALLBACKS.each do |cb|
    on(cb) { }
  end
end

class TestNotifier < Uppercut::Notifier
  notifier :foo do |m,data|
    m.to = 'foo@bar.com'
    m.send 'Foo happened!'
  end
end

Version data entries

3 entries across 3 versions & 3 rubygems

Version Path
tyler-uppercut-0.7.1 spec/spec_helper.rb
vasil-uppercut-0.7.1 spec/spec_helper.rb
uppercut-0.7.1 spec/spec_helper.rb