spec/config_spec.rb in chatterbot-0.5.1 vs spec/config_spec.rb in chatterbot-0.6.1
- old
+ new
@@ -94,10 +94,24 @@
@bot.verbose = true
@bot.config[:verbose].should == true
end
end
+ describe "reset_bot?" do
+ it "works when reset_bot isn't set" do
+ @bot.reset_bot?.should == false
+ end
+
+ it "works when reset_bot is set" do
+ @bot.config[:reset_since_id] = false
+ @bot.reset_bot?.should == false
+
+ @bot.config[:reset_since_id] = true
+ @bot.reset_bot?.should == true
+ end
+ end
+
describe "debug_mode?" do
it "works when debug_mode isn't set" do
@bot.debug_mode?.should == false
end
@@ -118,29 +132,30 @@
end
end
describe "update_since_id" do
it "works with searches" do
+# data = [ fake_tweet(1000) ]
+
+ data = fake_search(1000, 1).search
+
@bot.config[:tmp_since_id] = 100
- @bot.update_since_id({ "max_id" => 1000 })
+ @bot.update_since_id(data)
@bot.config[:tmp_since_id].should == 1000
end
it "works with tweets" do
@bot.config[:tmp_since_id] = 100
- @bot.update_since_id({ :id => 1000 })
+
+ data = fake_tweet(1000, 1000, true)
+ @bot.update_since_id(data)
@bot.config[:tmp_since_id].should == 1000
end
- it "handles weird results" do
- @bot.config[:tmp_since_id] = 100
- @bot.update_since_id({ :foo => 1000 })
- @bot.config[:tmp_since_id].should == 100
- end
-
it "never rolls back" do
@bot.config[:tmp_since_id] = 100
- @bot.update_since_id({ :id => 50 })
+ data = fake_tweet(50, 50, true)
+ @bot.update_since_id(data)
@bot.config[:tmp_since_id].should == 100
end
end