Sha256: 2e1833716e88869e881529ede1400ad969e9fc2304ff184c680dae1b6688c608

Contents?: true

Size: 958 Bytes

Versions: 2

Compression:

Stored size: 958 Bytes

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|
    c.instance_eval { @base.instance_eval { @called_hi = true } }
    c.send 'called hi'
  end
  
  command /^hi/ do |c|
    c.instance_eval { @base.instance_eval { @called_hi_regex = true } }
    c.send 'called high regex'
  end
  
  command /(good)?bye/ do |c,good|
    @called_goodbye = true
    c.send good ? "Good bye to you as well!" : "Rot!"
  end
  
  command 'wait' do |c|
    @called_wait = true
    c.send 'Waiting...'
    c.wait_for do |reply|
      @called_wait_block = true
      c.send 'Hooray!'
    end
  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

2 entries across 2 versions & 1 rubygems

Version Path
tyler-uppercut-0.5.0 specs/spec_helper.rb
tyler-uppercut-0.6.2 spec/spec_helper.rb