aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/date_and_time_behavior.rb
diff options
context:
space:
mode:
authorVipul A M <vipulnsward@gmail.com>2016-02-15 18:16:51 +0530
committerVipul A M <vipulnsward@gmail.com>2016-02-15 18:16:51 +0530
commit02a9e03c352e7c10e379368f6b41b0e2eaede07c (patch)
tree2d0f9f4a4eb8d6718c80958d5a6fd85d7b71e222 /activesupport/test/core_ext/date_and_time_behavior.rb
parentf800e00f9a7150f81dc2d27c26e6d1164df776f3 (diff)
downloadrails-02a9e03c352e7c10e379368f6b41b0e2eaede07c.tar.gz
rails-02a9e03c352e7c10e379368f6b41b0e2eaede07c.tar.bz2
rails-02a9e03c352e7c10e379368f6b41b0e2eaede07c.zip
Add `#on_weekday?` method to `Date`, `Time`, and `DateTime`.
Diffstat (limited to 'activesupport/test/core_ext/date_and_time_behavior.rb')
-rw-r--r--activesupport/test/core_ext/date_and_time_behavior.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/date_and_time_behavior.rb b/activesupport/test/core_ext/date_and_time_behavior.rb
index 784547bdf8..54df87def8 100644
--- a/activesupport/test/core_ext/date_and_time_behavior.rb
+++ b/activesupport/test/core_ext/date_and_time_behavior.rb
@@ -301,6 +301,16 @@ module DateAndTimeBehavior
assert_not date_time_init(2015,1,5,15,15,10).on_weekend?
end
+ def test_on_weekday_on_sunday
+ assert_not date_time_init(2015,1,4,0,0,0).on_weekday?
+ assert_not date_time_init(2015,1,4,15,15,10).on_weekday?
+ end
+
+ def test_on_weekday_on_monday
+ assert date_time_init(2015,1,5,0,0,0).on_weekday?
+ assert date_time_init(2015,1,5,15,15,10).on_weekday?
+ end
+
def with_bw_default(bw = :monday)
old_bw = Date.beginning_of_week
Date.beginning_of_week = bw