Sha256: 982ab4bf744744015355e79b97ae7b240e0c458579e444b65cf0dcb8645ed1e9

Contents?: true

Size: 1.15 KB

Versions: 9

Compression:

Stored size: 1.15 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe "Chatterbot::Helpers" do
  it "#tweet_user works with [:from_user]" do
    bot = Chatterbot::Bot.new
    bot.tweet_user({:from_user => "foo"}).should == "@foo"
    bot.tweet_user({:from_user => "@foo"}).should == "@foo"    
  end

  it "#tweet_user works with [:user][:screen_name]" do
    bot = Chatterbot::Bot.new
    bot.tweet_user({:user => {:screen_name => "foo"}}).should == "@foo"
    bot.tweet_user({:user => {:screen_name => "@foo"}}).should == "@foo"    
  end
   
  it "#tweet_user works with string" do
    bot = Chatterbot::Bot.new
    bot.tweet_user("foo").should == "@foo"
    bot.tweet_user("@foo").should == "@foo"    
  end
 
  describe "#botname" do    
    before(:each) do
      @bot = Chatterbot::Bot.new
      @bot.client = mock(Object)
    end

    it "calls botname smartly for inherited classes" do
      class TestBot < Chatterbot::Bot; end
      @bot2 = TestBot.new
      @bot2.botname.should == "testbot"
    end

    it "calls botname for non-inherited bots" do
      File.should_receive(:basename).and_return("bot")
      @bot.botname.should == "bot"
    end
  end
  
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
chatterbot-0.2.8 spec/helpers_spec.rb
chatterbot-0.2.7 spec/helpers_spec.rb
chatterbot-0.2.6 spec/helpers_spec.rb
chatterbot-0.2.5 spec/helpers_spec.rb
chatterbot-0.2.4 spec/helpers_spec.rb
chatterbot-0.2.3 spec/helpers_spec.rb
chatterbot-0.2.2 spec/helpers_spec.rb
chatterbot-0.2.1 spec/helpers_spec.rb
chatterbot-0.2.0 spec/helpers_spec.rb