spec/dsl_spec.rb in chatterbot-0.7.0 vs spec/dsl_spec.rb in chatterbot-0.7.1

- old
+ new

@@ -1,16 +1,22 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe "Chatterbot::DSL" do describe "client routines" do before(:each) do - @bot = mock(Chatterbot::Bot, :config => {}) + @bot = double(Chatterbot::Bot, :config => {}) @bot.send :require, 'chatterbot/dsl' - Chatterbot::DSL.stub!(:bot).and_return(@bot) + Chatterbot::DSL.stub(:bot).and_return(@bot) end + describe "client" do + it "returns the bot object" do + client.should eql(@bot.client) + end + end + describe "blacklist" do it "#blacklist passes along to bot object" do @bot.should_receive(:blacklist=).with(["foo"]) blacklist ["foo"] end @@ -118,14 +124,26 @@ describe "since_id" do it "should pass to bot object" do @bot.should_receive(:config).and_return({:since_id => 1234}) since_id.should == 1234 end + + it "can be set" do + since_id(1234) + @bot.config[:since_id].should == 1234 + end end + describe "since_id_reply" do + it "should pass to bot object" do + @bot.should_receive(:config).and_return({:since_id_reply => 1234}) + since_id_reply.should == 1234 + end + end + describe "db" do it "should pass to bot object" do - bot_db = mock(Object) + bot_db = double(Object) @bot.should_receive(:db).and_return(bot_db) db.should eql(bot_db) end end