Permalink
Browse files

fix the issue reported in the github regarding pluralize

  • Loading branch information...
1 parent dacf9b7 commit 3006a3137b58050fbf592116d11ea254e5194835 @abhidsm committed Sep 14, 2011
Showing with 4 additions and 4 deletions.
  1. +1 −1 VERSION
  2. +1 −1 lib/time_diff.rb
  3. +2 −2 test/test_time_diff.rb
View
2 VERSION
@@ -1 +1 @@
-0.2.1
+0.2.2
View
2 lib/time_diff.rb
@@ -65,7 +65,7 @@ def Time.format_date_time(time_diff_components, format_string)
end
def Time.pluralize(word, count)
- return count > 1 ? word.pluralize : word
+ return count != 1 ? word.pluralize : word
end
def Time.remove_format_string_for_zero_components(time_diff_components, format_string)
View
4 test/test_time_diff.rb
@@ -13,8 +13,8 @@ class TestTimeDiff < Test::Unit::TestCase
should "return the time difference in a formatted text" do
assert_test_scenarios_for_formatted_diff(Time.parse('2010-03-06 12:30:00'), Time.parse('2011-03-07 12:30:30'), '%y, %d and %h:%m:%s', '1 year and 18:00:30')
- assert_test_scenarios_for_formatted_diff(Time.parse('2010-03-06 12:30:00'), Time.parse('2011-03-07 12:30:30'), '%d %H %N %S', '366 days 0 hour 0 minute 30 seconds')
- assert_test_scenarios_for_formatted_diff(Time.parse('2011-03-06 12:30:00'), Time.parse('2011-03-07 12:30:30'), '%H %N %S', '24 hours 0 minute 30 seconds')
+ assert_test_scenarios_for_formatted_diff(Time.parse('2010-03-06 12:30:00'), Time.parse('2011-03-07 12:30:30'), '%d %H %N %S', '366 days 0 hours 0 minutes 30 seconds')
+ assert_test_scenarios_for_formatted_diff(Time.parse('2011-03-06 12:30:00'), Time.parse('2011-03-07 12:30:30'), '%H %N %S', '24 hours 0 minutes 30 seconds')
end
def assert_test_scenarios(start_date, end_date, expected_result)

0 comments on commit 3006a31

Please sign in to comment.