botfly 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.3.2
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{botfly}
8
- s.version = "0.3.1"
8
+ s.version = "0.3.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ryan Neufeld"]
12
- s.date = %q{2010-03-28}
12
+ s.date = %q{2010-04-02}
13
13
  s.description = %q{Botfly is a Jabber Bot DSL that lets you write bots with ease. Enjoy, while it's still fresh and VERY ALPHA.}
14
14
  s.email = %q{ryan@ryanneufeld.ca}
15
15
  s.extra_rdoc_files = [
@@ -45,9 +45,14 @@ Gem::Specification.new do |s|
45
45
  "lib/botfly/responder/responder.rb",
46
46
  "lib/botfly/responder/subscription_request_responder.rb",
47
47
  "retrobot.rb",
48
+ "spec/botfly/bot_spec.rb",
49
+ "spec/botfly/common_block_acceptor_spec.rb",
50
+ "spec/botfly/muc_client_spec.rb",
48
51
  "spec/botfly_spec.rb",
49
52
  "spec/spec.opts",
50
- "spec/spec_helper.rb"
53
+ "spec/spec_helper.rb",
54
+ "spec/support/custom_matchers.rb",
55
+ "spec/support/jabber.rb"
51
56
  ]
52
57
  s.homepage = %q{http://github.com/rkneufeld/botfly}
53
58
  s.rdoc_options = ["--charset=UTF-8"]
@@ -55,8 +60,13 @@ Gem::Specification.new do |s|
55
60
  s.rubygems_version = %q{1.3.6}
56
61
  s.summary = %q{A quick and easy DSL for generating Jabber bots}
57
62
  s.test_files = [
58
- "spec/botfly_spec.rb",
59
- "spec/spec_helper.rb"
63
+ "spec/botfly/bot_spec.rb",
64
+ "spec/botfly/common_block_acceptor_spec.rb",
65
+ "spec/botfly/muc_client_spec.rb",
66
+ "spec/botfly_spec.rb",
67
+ "spec/spec_helper.rb",
68
+ "spec/support/custom_matchers.rb",
69
+ "spec/support/jabber.rb"
60
70
  ]
61
71
 
62
72
  if s.respond_to? :specification_version then
@@ -14,12 +14,11 @@ require 'botfly/matcher'
14
14
  require 'botfly/muc_client'
15
15
 
16
16
 
17
-
18
17
  Thread.abort_on_exception = true
19
18
 
20
19
  module Botfly
21
20
  def Botfly.logger
22
- @logger = Logger.new(@logfile)
21
+ @logger ||= Logger.new(@logfile)
23
22
  return @logger
24
23
  end
25
24
  def Botfly.login(jid,pass,opts={},logfile=STDOUT,&block)
@@ -2,8 +2,7 @@ require 'rubygems'
2
2
 
3
3
  module Botfly
4
4
  class Bot < CommonBlockAcceptor
5
- attr_accessor :responders, :client, :roster, :jid
6
-
5
+ attr_reader :client, :roster, :jid, :host
7
6
  def initialize(jid,pass, opts = {})
8
7
  super
9
8
  Botfly.logger.info(" BOT: Bot#new")
@@ -23,9 +22,7 @@ module Botfly
23
22
  @roster = Jabber::Roster::Helper.new(@client)
24
23
  Botfly.logger.info(" BOT: Connected")
25
24
  register_for_callbacks
26
- @client.send(Jabber::Presence.new.set_status("Carrier has arrived"))
27
-
28
- #Thread.stop
25
+ self
29
26
  end
30
27
 
31
28
  def join(room_name,&block)
@@ -34,7 +31,7 @@ module Botfly
34
31
 
35
32
  def quit
36
33
  @client.close
37
- @main_thread.continue
34
+ @main_thread.wakeup
38
35
  end
39
36
 
40
37
  def to_debug_s; "BOT"; end
@@ -43,26 +40,23 @@ module Botfly
43
40
 
44
41
  def register_for_callbacks
45
42
  Botfly.logger.info(" BOT: Registering for callbacks with client")
46
- # @client.add_update_callback {|presence| respond_to(:update, :presence => presence) }
43
+ # @client.add_update_callback {|presence| respond_to(:update, :presence => presence) }
47
44
  @roster.add_subscription_request_callback do |item, pres| # requires Roster helper
48
- Botfly.logger.debug(" CB: Got Message")
49
45
  respond_to(:subscription_request, :roster_item => item, :presence => pres)
50
46
  end
51
47
 
52
48
  @client.add_message_callback do |message|
53
- Botfly.logger.debug(" CB: Got Message")
54
49
  respond_to(:message, :message => message)
55
50
  end
56
51
 
57
52
  @client.add_presence_callback do |new_presence,old_presence|
58
- Botfly.logger.debug(" CB: Got Presence")
59
- respond_to(:presence, :old => old_presence, :new => new_presence)
53
+ respond_to(:preesence, :old => old_presence, :new => new_presence)
60
54
  end
61
55
 
62
56
  end
63
57
 
64
58
  def respond_to(callback_type, params)
65
- Botfly.logger.info(" BOT: Responding to callback of type: #{callback_type}")
59
+ Botfly.logger.info(" BOT: Responding to #{callback_type}")
66
60
  @responders[callback_type].each {|r| r.callback_with params} if @responders[callback_type]
67
61
  end
68
62
  end
@@ -2,18 +2,16 @@ module Botfly
2
2
  class CommonBlockAcceptor
3
3
  extend Forwardable
4
4
 
5
- attr_accessor :responders
6
- attr_reader :client
5
+ attr_reader :block_state, :responders
7
6
 
8
- def initialize(jid,pass,opts={})
7
+ def initialize(*ignored)
9
8
  @block_state = {}
10
9
  @responders = {}
11
10
  end
12
11
 
13
- ABSTRACT_RAISE_ERROR = "AbstractMethodError: Implement in subclass"
14
- def to_debug_s; raise ABSTRACT_RAISE_ERROR; end
15
- def respond_to(type,params); raise ABSTRACT_RAISE_ERROR; end
16
- def on; raise ABSTRACT_RAISE_ERROR; end
12
+ def respond_to(type,params);
13
+ raise "AbstractMethodError: Implement in subclass"
14
+ end
17
15
 
18
16
  def [](key)
19
17
  @block_state[key]
@@ -35,18 +33,17 @@ module Botfly
35
33
  class OnRecognizer
36
34
  def initialize(obj); @obj = obj; end
37
35
 
38
- def method_missing(type,&block)
36
+ def method_missing(name,&block)
39
37
  Botfly.logger.info("#{@obj.to_debug_s}: Bot#on")
40
- type_name = type.to_s.split('_').map(&:capitalize).join('')
41
- klass = Botfly.const_get(@obj.class_prefix + type_name + "Responder")
42
- (@obj.responders[type] ||= []) << responder = klass.new(@obj, &block)
43
- Botfly.logger.info("#{@obj.to_debug_s}: #{@obj.class_prefix}#{type.to_s.capitalize}Responder added to responder chain")
38
+ klass = Botfly.const_get(@obj.class_prefix + name.to_s.capitalize + "Responder")
39
+ (@obj.responders[name] ||= []) << responder = klass.new(@obj, &block)
40
+ Botfly.logger.info("#{@obj.to_debug_s}: #{@obj.class_prefix}#{name.to_s.capitalize}Responder added to responder chain")
44
41
  return responder
45
42
  end
46
43
  end
47
44
 
48
- def class_prefix
49
- ''
50
- end
45
+ def class_prefix; ''; end
46
+ def to_debug_s; ''; end
47
+
51
48
  end
52
- end
49
+ end
@@ -2,7 +2,7 @@ require 'xmpp4r/muc'
2
2
 
3
3
  module Botfly
4
4
  class MUCClient < CommonBlockAcceptor
5
- attr_reader :bot, :muc
5
+ attr_reader :bot, :muc, :domain, :resource
6
6
 
7
7
  def room; @block_state; end
8
8
 
@@ -26,11 +26,11 @@ module Botfly
26
26
  return self
27
27
  end
28
28
 
29
- def leave_room; raise "Implement Me!"; end
29
+ def leave; @muc.exit; end
30
30
 
31
31
 
32
- def respond_to(callback_type, params)
33
- if (params[:nick] != @resource && Time.now > @connected_at_time + 3)#seconds # Don't run callbacks on the slew of launch messages (at least until I figure out a better way to differentiate them)
32
+ def respond_to(callback_type, params={})
33
+ if (params[:nick] != @resource ) # don't respond to self
34
34
  Botfly.logger.info("MUC: Responding to callback of type: #{callback_type} with time of #{params[:time]}")
35
35
  @responders[callback_type].each {|r| r.callback_with params} if @responders[callback_type]
36
36
  end
@@ -45,8 +45,7 @@ module Botfly
45
45
  @muc = Jabber::MUC::SimpleMUCClient.new(@bot.client)
46
46
  register_for_callbacks
47
47
  @jid = Jabber::JID.new("#{@room}@#{@domain}/#{@resource}")
48
- @connected_at_time = Time.now
49
- @muc.join(@jid)
48
+ @muc.join(@jid, nil, :history => false)
50
49
  Botfly.logger.info("MUC: Done connecting")
51
50
  end
52
51
 
@@ -67,4 +66,4 @@ module Botfly
67
66
  @muc.on_subject {|time,nick,subject| respond_to(:subject, :time => time, :nick => nick, :subject => subject)}
68
67
  end
69
68
  end
70
- end
69
+ end
@@ -34,21 +34,21 @@ bot = Botfly.login(config["jid"],config["pass"]) do
34
34
 
35
35
  sorted.each {|pair| say "#{pair[0]} => #{pair[-1]}"}#)}" : #{room[:voted][pair[0]].person} - #{room[:voted][pair[0]].name}" }
36
36
  end
37
- # on.message.from(/^rkneufeld/).body(/^rb tally$/) do
38
- # say "Tally HO! Please start your message with +, -, or ∂ (that's option-d) to have it tallied up"
39
- # say "================="
40
- # room[:tally_responders] = []; room[:tally] = {}
41
- # room[:plus] = {}; room[:minus] = {}; room[:delta] = {}
42
- #
43
- # room[:tally_responders] << on.message.body(/^\+(.*)/) { room[:tally][@from] ||= []; room[:tally][@from] << @body }
44
- # room[:tally_responders] << on.message.body(/^d (.*)/) { room[:tally][@from] ||= []; room[:tally][@from] << @body }
45
- # room[:tally_responders] << on.message.body(/^-(.*)/) { room[:tally][@from] ||= []; room[:tally][@from] << @body }
46
- # end
47
- # on.message.from(/^rkneufeld/).body(/^rb stop tally/) do
48
- # room[:tally_responders].each { |id| remove id }
49
- # room[:tally]
50
- # # stored to room[:voted]
37
+ on.message.from(/^rkneufeld/).body(/^rb tally$/) do
38
+ say "Tally HO! Please start your message with +, -, or ∂ (that's option-d) to have it tallied up"
39
+ say "================="
40
+ room[:tally_responders] = []; room[:tally] = {}
41
+ room[:plus] = {}; room[:minus] = {}; room[:delta] = {}
42
+
43
+ room[:tally_responders] << on.message.body(/^\+(.*)/) { room[:tally][@from] ||= []; room[:tally][@from] << @body }
44
+ room[:tally_responders] << on.message.body(/^d (.*)/) { room[:tally][@from] ||= []; room[:tally][@from] << @body }
45
+ room[:tally_responders] << on.message.body(/^-(.*)/) { room[:tally][@from] ||= []; room[:tally][@from] << @body }
51
46
  # end
47
+ on.message.from(/^rkneufeld/).body(/^rb stop tally/) do
48
+ room[:tally_responders].each { |id| remove id }
49
+ room[:tally]
50
+ # stored to room[:voted]
51
+ end
52
52
  end
53
53
  end
54
54
 
@@ -0,0 +1,86 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ include Botfly
4
+ describe Botfly::Bot do
5
+ context "initializer" do
6
+ subject { Bot.new('jid','pass', :gtalk => true) }
7
+ its(:responders) { should be_a Hash }# TODO: This is a really coupled way of checking for super being called
8
+ context "gtalk option is true" do
9
+ its(:host) { should == 'talk.google.com' }
10
+ end
11
+ end
12
+
13
+ context "instance" do
14
+ subject { Bot.new('jid','pass') }
15
+ context "readers & accessors" do
16
+ it { should respond_to :client }
17
+ it { should respond_to :roster }
18
+ it { should respond_to :responders }
19
+ it { should respond_to :host }
20
+ it { should respond_to :jid }
21
+ end
22
+ it { should respond_to :connect }
23
+ it { should respond_to :join }
24
+ it { should respond_to :quit }
25
+ it { should respond_to :[] }
26
+ it { should respond_to :[]= }
27
+ it { should respond_to :on }
28
+ it { should respond_to :remove_responder }
29
+ end
30
+
31
+ describe "#register_for_callbacks" do
32
+ let(:bot) { Bot.new('jid', 'pass') }
33
+ before(:each) { stub_jabber_client }
34
+ it "should register calls for each callback" do
35
+ bot.roster.should_receive :add_subscription_request_callback
36
+ bot.client.should_receive :add_presence_callback
37
+ bot.client.should_receive :add_message_callback
38
+ bot.send(:register_for_callbacks)
39
+ end
40
+ end
41
+
42
+ describe "#connect" do
43
+ let(:bot) { Bot.new('jid','pass') }
44
+ subject { bot }
45
+ after(:each) { bot.connect }
46
+ it "should execute methods in order" do
47
+ bot.client.should_receive(:connect).once.ordered
48
+ bot.client.should_receive(:auth).once.ordered
49
+ Jabber::Roster::Helper.should_receive(:new).with(bot.client).once.ordered
50
+ bot.should_receive(:register_for_callbacks).once.ordered
51
+ end
52
+ end
53
+
54
+ describe "#quit" do
55
+ let(:bot) { Bot.new('jid','pass') }
56
+ after(:each) { bot.quit }
57
+ specify { bot.client.should_receive(:close) }
58
+ specify { Thread.current.should_receive(:wakeup) }
59
+ end
60
+
61
+ describe "#join" do
62
+ let(:bot) { Bot.new('jid','pass') }
63
+ specify { MUCClient.should_receive(:new).with('foo', bot); bot.join('foo') {} }
64
+ end
65
+
66
+ describe "#respond_to" do
67
+ let(:bot) { Bot.new('jid', 'params') }
68
+ let(:responder) { mock "responder" }
69
+ let(:responders) { [responder] }
70
+ before(:each) { bot.responders[:foo] = responders; }
71
+ it "should find responders in the responder chain" do
72
+ bot.responders.should_receive(:[]).with(:foo)
73
+ bot.send(:respond_to, :foo, :bar)
74
+ end
75
+ it "should call #callback_with_params if responder exists for type" do
76
+ responder.should_receive(:callback_with).with(:bar)
77
+ bot.send(:respond_to, :foo, :bar)
78
+ end
79
+ it "should do nothing if no responder exists for callback" do
80
+ bot.responders.should_receive(:[]).with(:bar)
81
+ responder.should_not_receive(:callback_with)
82
+ bot.send(:respond_to, :bar, :foo)
83
+ end
84
+ end
85
+
86
+ end
@@ -0,0 +1,80 @@
1
+ require 'spec_helper'
2
+
3
+ include Botfly
4
+ describe CommonBlockAcceptor do
5
+ describe "initialize" do
6
+ its(:block_state) { should == {} }
7
+ its(:responders) { should == {} }
8
+ end
9
+
10
+ context "object" do
11
+ [:responders, :block_state, :[], :[]=, :on, :remove_responder].each do |m|
12
+ it { should respond_to m }
13
+ end
14
+ describe "#[]" do
15
+ let(:acceptor) { CommonBlockAcceptor.new }
16
+ it "should provide hash-like access to block_state" do
17
+ acceptor[:foo] = :bar
18
+ acceptor[:foo].should be :bar
19
+ end
20
+ end
21
+ end
22
+
23
+ context "abstract method" do
24
+ let(:acceptor) { CommonBlockAcceptor.new }
25
+ specify { expect { acceptor.respond_to(nil,nil) }.to raise_error /AbstractMethodError/ }
26
+ end
27
+
28
+ describe '#remove_responder' do
29
+ let(:acceptor) { CommonBlockAcceptor.new }
30
+ let(:responder) { stub :id => 1 }
31
+ before(:each) { acceptor.responders[:foo] = [responder] }
32
+ it "should remove responder with given id from the chain" do
33
+ expect { acceptor.remove_responder(1)}.to change { acceptor.responders.values.flatten.count }.to 0 # FIXME: Refactor from Hash to actual ResponderChain object
34
+ end
35
+ end
36
+
37
+ describe "#class_prefix" do
38
+ let(:acceptor) { CommonBlockAcceptor.new }
39
+ its(:class_prefix) { should be_empty }
40
+ end
41
+
42
+ describe "#on" do
43
+ subject { CommonBlockAcceptor.new.on }
44
+ it { should be_an CommonBlockAcceptor::OnRecognizer }
45
+ end
46
+
47
+ context "::OnRecognizer" do
48
+ let(:acceptor) { CommonBlockAcceptor.new }
49
+ let(:on) { acceptor.on }
50
+ before(:each) do
51
+ class FooResponder; def initialize(bar); end; end
52
+ class FooBarResponder; def initialize(baz);end; end
53
+ end
54
+
55
+ it "should instanciate responder based on name" do
56
+ FooResponder.should_receive(:new)
57
+ on.foo
58
+ end
59
+
60
+ it "should add class prefix to front of responder class" do
61
+ acceptor.stub(:class_prefix).and_return('Foo')
62
+ Botfly.should_receive(:const_get).with('FooBarResponder').and_return(FooBarResponder)
63
+ on.bar
64
+ end
65
+
66
+ it "should add responder to object's responder chain hash" do
67
+ FooResponder.stub(:new).and_return(:foo_instance)
68
+ acceptor.responders.should == {}
69
+ expect { on.foo }.to
70
+ change { acceptor.responders }.
71
+ from({}).to({:foo => [:foo_instance]})
72
+ end
73
+
74
+ it "should return the responder itself" do
75
+ FooResponder.stub(:new).and_return(:foo_instance)
76
+ on.foo.should be :foo_instance
77
+ end
78
+ end
79
+ end
80
+
@@ -0,0 +1,95 @@
1
+ require 'spec_helper'
2
+
3
+ include Botfly
4
+ describe Botfly::MUCClient do
5
+ let(:jid) { stub("JID", :domain => 'domain.com', :node => 'resource') }
6
+ let(:bot) { stub("Bot", :client => stub_jabber_client, :jid => jid) }
7
+ let(:muc) do
8
+ cbs = [:join, :leave, :message, :room_message, :self_leave, :subject]
9
+ cbs = cbs.inject({}) { |h,cb| h[:"on_#{cb}"] = nil; h }
10
+ muc = stub("Jabber::MUC::SimpleMUCClient", cbs.merge(:join => nil))
11
+ muc
12
+ end
13
+ let(:muc_client) { MUCClient.new("Room", bot) { } }
14
+ context "initializer" do
15
+ subject { muc_client }
16
+
17
+ [:bot, :client, :room, :domain, :resource].each do |ivar|
18
+ it { should assign ivar }
19
+ end
20
+ its(:domain) { should == 'conference.domain.com' }
21
+ its(:resource) { should == 'resource' }
22
+ it "should run the passed block" do
23
+ expect { MUCClient.new("Room", bot) {raise "ran!"} }.to raise_error "ran!"
24
+ end
25
+ end
26
+
27
+ describe "#room" do
28
+ it "should expose access to @block_state" do
29
+ muc_client.room.should == muc_client.instance_variable_get("@block_state")
30
+ end
31
+ end
32
+
33
+ describe "#execute" do
34
+ it "should connect before running" do
35
+ muc_client.should_receive(:connect).ordered
36
+ muc_client.should_receive(:instance_eval).ordered
37
+ muc_client.as("foo") {}
38
+ end
39
+ it "should execute block" do
40
+ block = lambda { raise "Ran" }
41
+ expect { muc_client.send(:execute, &block) }.to raise_error "Ran"
42
+ end
43
+
44
+ end
45
+
46
+ describe "#connect" do
47
+ let(:muc_client) { MUCClient.new("Room", bot) }
48
+ after(:each) { muc_client.send(:connect) }
49
+ it "should complete all steps in order" do
50
+ Jabber::MUC::SimpleMUCClient.should_receive(:new).ordered.and_return(muc)
51
+ muc_client.should_receive(:register_for_callbacks).ordered
52
+ muc.should_receive(:join).ordered
53
+ end
54
+ end
55
+
56
+ describe "#as" do
57
+ subject { muc_client }
58
+ it "should assign resource to given" do
59
+ muc_client.as(:the_boss)
60
+ muc_client.resource.should be :the_boss
61
+ end
62
+ it "should execute if given a block" do
63
+ expect { muc_client.as(:foo) { raise "Ran" }}.to raise_error "Ran"
64
+ end
65
+ end
66
+
67
+ describe "#leave" do
68
+ it "should leave the chat room" do
69
+ muc_client.muc.should_receive(:exit)
70
+ muc_client.leave
71
+ end
72
+ end
73
+
74
+ describe "#respond_to" do
75
+ it "should respond to with appropriate responder" do
76
+ muc_client.responders[:foo] = [stub("responder", :callback_with => nil)]
77
+ muc_client.send(:respond_to, :foo)
78
+ end
79
+ it "should tell xmpp4r not to send history" do
80
+ muc.should_receive(:join).with(anything, nil, hash_including(:history => false))
81
+ Jabber::MUC::SimpleMUCClient.stub(:new).and_return(muc)
82
+ muc_client.send(:connect)
83
+ end
84
+ end
85
+
86
+ describe "#register_for_callbacks" do
87
+ it "should register calls for each callback" do
88
+ Jabber::MUC::SimpleMUCClient.stub(:new).and_return(muc)
89
+ [:join, :leave, :message, :room_message, :self_leave, :subject].each do |type|
90
+ muc.should_receive(:"on_#{type}")
91
+ end
92
+ muc_client.send(:register_for_callbacks)
93
+ end
94
+ end
95
+ end
@@ -1,7 +1,23 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
- describe "Botfly" do
4
- it "fails" do
5
- fail "hey buddy, you should probably rename this file and start specing for real"
3
+ describe Botfly do
4
+ describe ".logger" do
5
+ subject { Botfly.logger }
6
+ it { should be_a Logger }
7
+ end
8
+
9
+ describe ".login" do
10
+ it "should connect before evaluation of block" do
11
+ @bot = mock("bot")
12
+ Botfly::Bot.should_receive(:new).and_return(@bot)
13
+ @bot.should_receive(:connect).ordered.once
14
+ @bot.should_receive(:instance_exec).ordered.once
15
+ Botfly.login('jid','pass')
16
+ end
17
+ it "should create a new bot" do
18
+ stub_jabber_client
19
+ bot = Botfly.login('jid','pass') { }
20
+ bot.should be_a Botfly::Bot
21
+ end
6
22
  end
7
23
  end
@@ -1 +1,2 @@
1
1
  --color
2
+ --backtrace
@@ -3,7 +3,15 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
3
  require 'botfly'
4
4
  require 'spec'
5
5
  require 'spec/autorun'
6
+ require 'support/jabber'
7
+ require 'support/custom_matchers'
6
8
 
7
9
  Spec::Runner.configure do |config|
8
-
10
+ Botfly.logger.level = Logger::FATAL
11
+ end
12
+
13
+ class Object
14
+ def assigns(name)
15
+ instance_variable_get("@#{name}")
16
+ end
9
17
  end
@@ -0,0 +1,9 @@
1
+ Spec::Matchers.define :assign do |ivar|
2
+ match do |klass|
3
+ check_assignment(klass,ivar)
4
+ end
5
+ description { "assign to the instance variable @#{ivar}" }
6
+ def check_assignment(klass,ivar)
7
+ klass.instance_variable_get("@#{ivar}") != nil
8
+ end
9
+ end
@@ -0,0 +1,8 @@
1
+ def stub_jabber_client
2
+ client = stub("Jabber::Client", :connect => nil,
3
+ :auth => nil,
4
+ :send => nil)
5
+ def client.method_missing(*args); end
6
+ Jabber::Client.stub(:new).and_return(client)
7
+ client
8
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 1
9
- version: 0.3.1
8
+ - 2
9
+ version: 0.3.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ryan Neufeld
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-28 00:00:00 -06:00
17
+ date: 2010-04-02 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -82,9 +82,14 @@ files:
82
82
  - lib/botfly/responder/responder.rb
83
83
  - lib/botfly/responder/subscription_request_responder.rb
84
84
  - retrobot.rb
85
+ - spec/botfly/bot_spec.rb
86
+ - spec/botfly/common_block_acceptor_spec.rb
87
+ - spec/botfly/muc_client_spec.rb
85
88
  - spec/botfly_spec.rb
86
89
  - spec/spec.opts
87
90
  - spec/spec_helper.rb
91
+ - spec/support/custom_matchers.rb
92
+ - spec/support/jabber.rb
88
93
  has_rdoc: true
89
94
  homepage: http://github.com/rkneufeld/botfly
90
95
  licenses: []
@@ -116,5 +121,10 @@ signing_key:
116
121
  specification_version: 3
117
122
  summary: A quick and easy DSL for generating Jabber bots
118
123
  test_files:
124
+ - spec/botfly/bot_spec.rb
125
+ - spec/botfly/common_block_acceptor_spec.rb
126
+ - spec/botfly/muc_client_spec.rb
119
127
  - spec/botfly_spec.rb
120
128
  - spec/spec_helper.rb
129
+ - spec/support/custom_matchers.rb
130
+ - spec/support/jabber.rb