Permalink
Browse files

Use to float to ensure 1min30 + gets rounded up

  • Loading branch information...
1 parent 1a7c277 commit 4c97185eab3008c9ac1100cea8df86e52ec75fc0 @jenkoian jenkoian committed Jan 20, 2013
Showing with 2 additions and 2 deletions.
  1. +1 −1 lib/readingtime.rb
  2. +1 −1 spec/readingtime_spec.rb
View
@@ -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
@@ -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

0 comments on commit 4c97185

Please sign in to comment.