Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use to float to ensure 1min30 + gets rounded up

  • Loading branch information...
commit 4c97185eab3008c9ac1100cea8df86e52ec75fc0 1 parent 1a7c277
@jenkoian jenkoian authored
Showing with 2 additions and 2 deletions.
  1. +1 −1  lib/readingtime.rb
  2. +1 −1  spec/readingtime_spec.rb
View
2  lib/readingtime.rb
@@ -22,7 +22,7 @@ def self.format_words(seconds)
def self.format_approx(seconds)
if seconds > 59
- '%d minutes' % (seconds/60).round
+ '%d minutes' % (seconds.to_f/60).round
else
'%d seconds' % seconds
end
View
2  spec/readingtime_spec.rb
@@ -40,7 +40,7 @@
two_hundred_words.reading_time(:format => :long).should == "1 minutes and 0 seconds"
two_hundred_words.reading_time(:format => :approx).should == "1 minutes"
three_hundred_words.reading_time(:format => :long).should == "1 minutes and 33 seconds"
- three_hundred_words.reading_time(:format => :approx).should == "1 minutes"
+ three_hundred_words.reading_time(:format => :approx).should == "2 minutes"
end
it "should return a time in seconds when using approx with time less than 1 minute" do
Please sign in to comment.
Something went wrong with that request. Please try again.