Class: TestDayForDate
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- TestDayForDate
- Defined in:
- lib/test/modules/date/test_day.rb
Instance Method Summary collapse
- #test_all_non_week_days_of_month ⇒ Object
- #test_all_working_days_of_month ⇒ Object
- #test_days_array ⇒ Object
- #test_days_array_monday ⇒ Object
- #test_first_working_day_of_the_month ⇒ Object
- #test_name_of_week_day ⇒ Object
- #test_previous_friday ⇒ Object
- #test_previous_monday ⇒ Object
- #test_previous_saturday ⇒ Object
- #test_previous_sunday ⇒ Object
- #test_previous_thursday ⇒ Object
- #test_previous_tuesday ⇒ Object
- #test_previous_wednesday ⇒ Object
- #test_upcoming_friday ⇒ Object
- #test_upcoming_monday ⇒ Object
- #test_upcoming_saturday ⇒ Object
- #test_upcoming_sunday ⇒ Object
- #test_upcoming_thursday ⇒ Object
- #test_upcoming_tuesday ⇒ Object
- #test_upcoming_wednesday ⇒ Object
Instance Method Details
#test_all_non_week_days_of_month ⇒ Object
131 132 133 134 135 136 137 138 |
# File 'lib/test/modules/date/test_day.rb', line 131 def test_all_non_week_days_of_month assert_equal [ Date.new(2013, 4, 28), Date.new(2013, 4, 27), Date.new(2013, 4, 21), Date.new(2013, 4, 20), Date.new(2013, 4, 14), Date.new(2013, 4, 13), Date.new(2013, 4, 7), Date.new(2013, 4, 6) ], Date.new(2013, 4, 1).all_non_week_days_of_month end |
#test_all_working_days_of_month ⇒ Object
121 122 123 124 125 126 127 128 129 |
# File 'lib/test/modules/date/test_day.rb', line 121 def test_all_working_days_of_month assert_equal [ Date.new(2013, 4, 30), Date.new(2013, 4, 29), Date.new(2013, 4, 26), Date.new(2013, 4, 25), Date.new(2013, 4, 24), Date.new(2013, 4, 23), Date.new(2013, 4, 22), Date.new(2013, 4, 19), Date.new(2013, 4, 18), Date.new(2013, 4, 17), Date.new(2013, 4, 16), Date.new(2013, 4, 15), Date.new(2013, 4, 12), Date.new(2013, 4, 11), Date.new(2013, 4, 10), Date.new(2013, 4, 9), Date.new(2013, 4, 8), Date.new(2013, 4, 5), Date.new(2013, 4, 4), Date.new(2013, 4, 3), Date.new(2013, 4, 2), Date.new(2013, 4, 1) ], Date.new(2013, 4, 1).all_working_days_of_month end |
#test_days_array ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/test/modules/date/test_day.rb', line 8 def test_days_array object = Date.new(2012, 2, 8) days_array_for_february = [nil, nil, nil, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29] assert_kind_of Array, object.days_array assert_equal days_array_for_february, object.days_array object = Date.new(2012, 7, 1) days_array_for_july = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31] assert_kind_of Array, object.days_array assert_equal days_array_for_july, object.days_array end |
#test_days_array_monday ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/test/modules/date/test_day.rb', line 28 def test_days_array_monday WeekOfMonth.configuration.monday_active = true object = Date.new(2014, 11, 3) days_array_for_november = [nil, nil, nil, nil, nil, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30] assert_kind_of Array, object.days_array assert_equal days_array_for_november, object.days_array object = Date.new(2014, 12, 1) days_array_for_december = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31] assert_kind_of Array, object.days_array assert_equal days_array_for_december, object.days_array end |
#test_first_working_day_of_the_month ⇒ Object
140 141 142 |
# File 'lib/test/modules/date/test_day.rb', line 140 def test_first_working_day_of_the_month assert_equal Date.new(2013, 1, 1), Date.new(2013, 1, 1).first_working_day_of_the_month end |
#test_name_of_week_day ⇒ Object
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/test/modules/date/test_day.rb', line 50 def test_name_of_week_day WeekOfMonth.configuration.monday_active = false assert_equal 'Saturday', Date.new(2012, 12, 1).name_of_week_day assert_equal 'Sunday', Date.new(2012, 12, 2).name_of_week_day assert_equal 'Monday', Date.new(2012, 12, 3).name_of_week_day assert_equal 'Tuesday', Date.new(2012, 12, 4).name_of_week_day assert_equal 'Wednesday', Date.new(2012, 12, 5).name_of_week_day assert_equal 'Thursday', Date.new(2012, 12, 6).name_of_week_day assert_equal 'Friday', Date.new(2012, 12, 7).name_of_week_day end |
#test_previous_friday ⇒ Object
96 97 98 |
# File 'lib/test/modules/date/test_day.rb', line 96 def test_previous_friday assert_equal Date.new(2012, 12, 28), Date.new(2013, 1, 1).previous_friday end |
#test_previous_monday ⇒ Object
112 113 114 |
# File 'lib/test/modules/date/test_day.rb', line 112 def test_previous_monday assert_equal Date.new(2012, 12, 31), Date.new(2013, 1, 1).previous_monday end |
#test_previous_saturday ⇒ Object
92 93 94 |
# File 'lib/test/modules/date/test_day.rb', line 92 def test_previous_saturday assert_equal Date.new(2012, 12, 29), Date.new(2013, 1, 1).previous_saturday end |
#test_previous_sunday ⇒ Object
116 117 118 119 |
# File 'lib/test/modules/date/test_day.rb', line 116 def test_previous_sunday assert_equal Date.new(2012, 12, 30), Date.new(2013, 1, 1).previous_sunday assert_equal Date.new(2012, 12, 30), Date.new(2013, 1, 1).previous_sunday end |
#test_previous_thursday ⇒ Object
100 101 102 |
# File 'lib/test/modules/date/test_day.rb', line 100 def test_previous_thursday assert_equal Date.new(2012, 12, 27), Date.new(2013, 1, 1).previous_thursday end |
#test_previous_tuesday ⇒ Object
108 109 110 |
# File 'lib/test/modules/date/test_day.rb', line 108 def test_previous_tuesday assert_equal Date.new(2012, 12, 25), Date.new(2013, 1, 1).previous_tuesday end |
#test_previous_wednesday ⇒ Object
104 105 106 |
# File 'lib/test/modules/date/test_day.rb', line 104 def test_previous_wednesday assert_equal Date.new(2012, 12, 26), Date.new(2013, 1, 1).previous_wednesday end |
#test_upcoming_friday ⇒ Object
84 85 86 |
# File 'lib/test/modules/date/test_day.rb', line 84 def test_upcoming_friday assert_equal Date.new(2013, 1, 4), Date.new(2013, 1, 1).upcoming_friday end |
#test_upcoming_monday ⇒ Object
68 69 70 |
# File 'lib/test/modules/date/test_day.rb', line 68 def test_upcoming_monday assert_equal Date.new(2013, 1, 7), Date.new(2013, 1, 1).upcoming_monday end |
#test_upcoming_saturday ⇒ Object
88 89 90 |
# File 'lib/test/modules/date/test_day.rb', line 88 def test_upcoming_saturday assert_equal Date.new(2013, 1, 5), Date.new(2013, 1, 1).upcoming_saturday end |
#test_upcoming_sunday ⇒ Object
61 62 63 64 65 66 |
# File 'lib/test/modules/date/test_day.rb', line 61 def test_upcoming_sunday assert_equal Date.new(2013, 1, 6), Date.new(2013, 1, 1).upcoming_sunday assert_equal Date.new(2013, 1, 6), Date.new(2013, 1, 5).upcoming_sunday assert_equal Date.new(2013, 1, 13), Date.new(2013, 1, 7).upcoming_sunday assert_equal Date.new(2013, 1, 6), Date.new(2012, 12, 30).upcoming_sunday end |
#test_upcoming_thursday ⇒ Object
80 81 82 |
# File 'lib/test/modules/date/test_day.rb', line 80 def test_upcoming_thursday assert_equal Date.new(2013, 1, 3), Date.new(2013, 1, 1).upcoming_thursday end |