Sha256: 1a338974c738c6bbe3635303fb59eec8f86dbfad30be6d9779f5f7057c0cdd4f
Contents?: true
Size: 973 Bytes
Versions: 7
Compression:
Stored size: 973 Bytes
Contents
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') require 'tempfile' describe "Chatterbot::Logging" do describe "debug logging" do before(:each) do @bot = Chatterbot::Bot.new @logger = double(Logger) allow(@bot).to receive(:logger).and_return(@logger) end it "should call logger on debug" do expect(@bot).to receive(:logging?).and_return(true) expect(@logger).to receive(:debug).with("rspec hi!") @bot.debug "hi!" end it "should not call logger when not logging desired" do expect(@bot).to receive(:logging?).and_return(false) expect(@logger).not_to receive(:debug) @bot.debug "hi!" end it "should call logger and also print output when critical" do expect(@bot).to receive(:logging?).and_return(true) expect(@logger).to receive(:debug).with("rspec hi!") expect(@bot).to receive(:puts).with("hi!") @bot.critical "hi!" end end end
Version data entries
7 entries across 7 versions & 1 rubygems