Class: TestDay
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- TestDay
- Defined in:
- lib/test/modules/test_day.rb
Instance Method Summary collapse
- #test_days_array ⇒ 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_days_array ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/test/modules/test_day.rb', line 9 def test_days_array [Date,Time].each do |klass| object = klass.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 = klass.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 end |
#test_name_of_week_day ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/test/modules/test_day.rb', line 31 def test_name_of_week_day [Date,Time].each do |klass| assert_equal "Saturday", klass.new(2012,12,1).name_of_week_day assert_equal "Sunday", klass.new(2012,12,2).name_of_week_day assert_equal "Monday", klass.new(2012,12,3).name_of_week_day assert_equal "Tuesday", klass.new(2012,12,4).name_of_week_day assert_equal "Wednesday", klass.new(2012,12,5).name_of_week_day assert_equal "Thursday", klass.new(2012,12,6).name_of_week_day assert_equal "Friday", klass.new(2012,12,7).name_of_week_day end end |
#test_previous_friday ⇒ Object
94 95 96 97 98 |
# File 'lib/test/modules/test_day.rb', line 94 def test_previous_friday [Date,Time].each do |klass| assert_equal klass.new(2012,12,28), klass.new(2013,1,1).previous_friday end end |
#test_previous_monday ⇒ Object
118 119 120 121 122 |
# File 'lib/test/modules/test_day.rb', line 118 def test_previous_monday [Date,Time].each do |klass| assert_equal klass.new(2012,12,31), klass.new(2013,1,1).previous_monday end end |
#test_previous_saturday ⇒ Object
88 89 90 91 92 |
# File 'lib/test/modules/test_day.rb', line 88 def test_previous_saturday [Date,Time].each do |klass| assert_equal klass.new(2012,12,29), klass.new(2013,1,1).previous_saturday end end |
#test_previous_sunday ⇒ Object
124 125 126 127 128 |
# File 'lib/test/modules/test_day.rb', line 124 def test_previous_sunday [Date,Time].each do |klass| assert_equal klass.new(2012,12,30), klass.new(2013,1,1).previous_sunday end end |
#test_previous_thursday ⇒ Object
100 101 102 103 104 |
# File 'lib/test/modules/test_day.rb', line 100 def test_previous_thursday [Date,Time].each do |klass| assert_equal klass.new(2012,12,27), klass.new(2013,1,1).previous_thursday end end |
#test_previous_tuesday ⇒ Object
112 113 114 115 116 |
# File 'lib/test/modules/test_day.rb', line 112 def test_previous_tuesday [Date,Time].each do |klass| assert_equal klass.new(2012,12,25), klass.new(2013,1,1).previous_tuesday end end |
#test_previous_wednesday ⇒ Object
106 107 108 109 110 |
# File 'lib/test/modules/test_day.rb', line 106 def test_previous_wednesday [Date,Time].each do |klass| assert_equal klass.new(2012,12,26), klass.new(2013,1,1).previous_wednesday end end |
#test_upcoming_friday ⇒ Object
76 77 78 79 80 |
# File 'lib/test/modules/test_day.rb', line 76 def test_upcoming_friday [Date,Time].each do |klass| assert_equal klass.new(2013,1,4), klass.new(2013,1,1).upcoming_friday end end |
#test_upcoming_monday ⇒ Object
52 53 54 55 56 |
# File 'lib/test/modules/test_day.rb', line 52 def test_upcoming_monday [Date,Time].each do |klass| assert_equal klass.new(2013,1,7), klass.new(2013,1,1).upcoming_monday end end |
#test_upcoming_saturday ⇒ Object
82 83 84 85 86 |
# File 'lib/test/modules/test_day.rb', line 82 def test_upcoming_saturday [Date,Time].each do |klass| assert_equal klass.new(2013,1,5), klass.new(2013,1,1).upcoming_saturday end end |
#test_upcoming_sunday ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/test/modules/test_day.rb', line 43 def test_upcoming_sunday [Date,Time].each do |klass| assert_equal klass.new(2013,1,6), klass.new(2013,1,1).upcoming_sunday assert_equal klass.new(2013,1,6), klass.new(2013,1,5).upcoming_sunday assert_equal klass.new(2013,1,13), klass.new(2013,1,7).upcoming_sunday assert_equal klass.new(2013,1,6), klass.new(2012,12,30).upcoming_sunday end end |
#test_upcoming_thursday ⇒ Object
70 71 72 73 74 |
# File 'lib/test/modules/test_day.rb', line 70 def test_upcoming_thursday [Date,Time].each do |klass| assert_equal klass.new(2013,1,3), klass.new(2013,1,1).upcoming_thursday end end |