This type of floating point comparison is generally invalid. Ruby has a zero? method on floating point for this reason. You may need to cast the duration to float: `duration.to_f.zero?`

http://www.ruby-doc.org/core-1.9.3/Float.html#method-i-zero-3F