spec/dsl_spec.rb in chatterbot-0.4.0 vs spec/dsl_spec.rb in chatterbot-0.5.0
- old
+ new
@@ -6,11 +6,11 @@
@bot = mock(Chatterbot::Bot)
@bot.send :require, 'chatterbot/dsl'
Chatterbot::DSL.stub!(:bot).and_return(@bot)
end
-
+
describe "blacklist" do
it "#blacklist passes along to bot object" do
@bot.should_receive(:blacklist=).with(["foo"])
blacklist ["foo"]
end
@@ -37,16 +37,16 @@
@bot.should_receive("#{method.to_s}=").with(false)
send method, false
end
it "#debug_mode with true is passed" do
- @bot.should_receive("#{method.to_s}=").with(true)
+ @bot.should_receive("#{method.to_s}=").with(true)
send method, true
end
end
end
-
+
describe "exclude" do
it "#exclude passes along to bot object" do
@bot.should_receive(:exclude=).with(["foo"])
exclude ["foo"]
end
@@ -59,22 +59,22 @@
it "#exclude turns comma-delimited string arg into an array" do
@bot.should_receive(:exclude=).with(["foo", "bar"])
exclude "foo, bar"
end
end
-
-
+
+
it "#search passes along to bot object" do
@bot.should_receive(:search).with("foo", { })
search("foo")
end
it "#search passes along to bot object" do
@bot.should_receive(:search).with(["foo","bar"], { })
search(["foo","bar"])
end
-
+
it "#replies passes along to bot object" do
@bot.should_receive(:replies)
replies
end
@@ -84,11 +84,11 @@
end
it "#reply passes along to bot object" do
@bot.should_receive(:reply).with("hello sailor!", { :source => "source "})
reply "hello sailor!", { :source => "source "}
- end
+ end
describe "update_config" do
it "should pass to bot object" do
@bot.should_receive(:update_config)
update_config
@@ -97,9 +97,18 @@
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
+ end
+
+ describe "db" do
+ it "should pass to bot object" do
+ bot_db = mock(Object)
+ @bot.should_receive(:db).and_return(bot_db)
+
+ db.should eql(bot_db)
end
end
end
end