Commit 455925b980ab9c3604503268da198de8759c62d3

Authored by Andrew Kane
1 parent d3d3e824

Fixed week_start option for enumerables

Showing 2 changed files with 5 additions and 5 deletions   Show diff stats
lib/groupdate/magic.rb
... ... @@ -320,7 +320,7 @@ module Groupdate
320 320 when :hour_of_day
321 321 time.hour
322 322 when :day_of_week
323   - (7 - week_start + ((time.wday - 1) % 7) % 7)
  323 + time.wday
324 324 when :day_of_month
325 325 time.day
326 326 when :month_of_year
... ...
test/test_helper.rb
... ... @@ -962,17 +962,17 @@ module TestGroupdate
962 962  
963 963 def test_format_hour_of_day_day_start
964 964 create_user "2014-03-01"
965   - assert_format :hour_of_day, "2 am", "%-l %P", day_start: 2
  965 + assert_format :hour_of_day, "12 am", "%-l %P", day_start: 2
966 966 end
967 967  
968 968 def test_format_day_of_week
969 969 create_user "2014-03-01"
970   - assert_format :day_of_week, "Sun", "%a"
  970 + assert_format :day_of_week, "Sat", "%a"
971 971 end
972 972  
973 973 def test_format_day_of_week_week_start
974 974 create_user "2014-03-01"
975   - assert_format :day_of_week, "Sun", "%a", week_start: :sat
  975 + assert_format :day_of_week, "Sat", "%a", week_start: :mon
976 976 end
977 977  
978 978 def test_format_day_of_month
... ... @@ -1016,7 +1016,7 @@ module TestGroupdate
1016 1016 # helpers
1017 1017  
1018 1018 def assert_format(method, expected, format, options = {})
1019   - assert_equal expected, call_method(method, :created_at, options.merge(format: format, series: true)).keys.first
  1019 + assert_equal({expected => 1}, call_method(method, :created_at, options.merge(format: format, series: false)))
1020 1020 end
1021 1021  
1022 1022 def assert_result_time(method, expected, time_str, time_zone = false, options = {})
... ...