spec/logging_spec.rb in chatterbot-1.0.2 vs spec/logging_spec.rb in chatterbot-2.0.0.pre
- old
+ new
@@ -27,40 +27,6 @@
expect(@bot).to receive(:puts).with("hi!")
@bot.critical "hi!"
end
end
- describe "#log to database" do
- before(:each) do
- @db_tmp = Tempfile.new("config.db")
- @db_uri = "sqlite://#{@db_tmp.path}"
-
- @bot = Chatterbot::Bot.new
- @bot.config[:db_uri] = @db_uri
-
- expect(@bot).to receive(:log_tweets?).and_return(true)
-
- expect(@bot).to receive(:botname).and_return("logger")
- allow(Time).to receive(:now).and_return(123)
-
- @tweets_table = double(Object)
- allow(@bot).to receive(:db).and_return({
- :tweets => @tweets_table
- })
- end
-
- it "logs tweets to the db" do
- expect(@tweets_table).to receive(:insert).with({ :txt => "TEST", :bot => "logger", :created_at => 123})
- @bot.log "TEST"
- end
-
- it "logs tweets with some source info to the db" do
- source_tweet = Twitter::Tweet.new({:id => 12345, :text => "i should trigger a bot", :user => {:screen_name => "replytome", :id => 456}})
-
- params = {:txt=>"TEST", :bot=>"logger", :created_at=>123, :user=>"replytome", :source_id=>12345, :source_tweet=>"i should trigger a bot"}
-
- expect(@tweets_table).to receive(:insert).with(params)
-
- @bot.log "TEST", source_tweet
- end
- end
end