Skip to content
Extraits de code Groupes Projets
Valider 0588dafe rédigé par Philip Champon's avatar Philip Champon
Parcourir les fichiers

added enumeration to args and a spec to verify it

parent 087e0389
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -16,8 +16,7 @@ module ResqueJobLogging
log_string += "status=complete "
end
log_string += "ms=#{time} "
arg_count = 1
args.each{|arg| log_string += "arg#{arg_count}=\"#{arg.to_s[0..30]}\" "}
args.each_with_index{|arg,idx| log_string += "arg#{idx.succ}=\"#{arg.to_s[0..30]}\" "}
Rails.logger.info(log_string)
raise error if error
......
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
require 'spec_helper'
describe ResqueJobLogging do
before do
Rails.stub!(:logger).and_return(mock())
Rails.logger.should_receive(:auto_flushing=).with(1)
Object.const_set("ResqueJobLoggingDummy", Class.new(Object))
ResqueJobLoggingDummy.extend(ResqueJobLogging)
end
after do
Rails.unstub!(:logger)
end
# http://bugs.joindiaspora.com/issues/741
it "should enumerate arguments" do
Rails.logger.should_receive(:info).with(/arg1="foo" arg2="bar" arg3="baz"/)
## pass a nil block, so we can test the .info() output
ResqueJobLoggingDummy.around_perform_log_job("foo", "bar", "baz") {}
end
end
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter