nickel 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,47 +1,47 @@
1
- require "spec_helper"
2
- require_relative "../../../lib/nickel/zdate"
1
+ require 'spec_helper'
2
+ require_relative '../../../lib/nickel/zdate'
3
3
 
4
4
  module Nickel
5
5
  describe ZDate do
6
- describe "#get_next_date_from_date_of_month" do
7
- let(:d1) { ZDate.new("20090927") }
6
+ describe '#get_next_date_from_date_of_month' do
7
+ let(:d1) { ZDate.new('20090927') }
8
8
 
9
- it "is the next date with that day of the month" do
10
- expect(d1.get_next_date_from_date_of_month(28)).to eq ZDate.new("20090928")
11
- expect(d1.get_next_date_from_date_of_month(5)).to eq ZDate.new("20091005")
9
+ it 'is the next date with that day of the month' do
10
+ expect(d1.get_next_date_from_date_of_month(28)).to eq ZDate.new('20090928')
11
+ expect(d1.get_next_date_from_date_of_month(5)).to eq ZDate.new('20091005')
12
12
  end
13
13
 
14
- it "is nil when the current month has no such day of month" do
14
+ it 'is nil when the current month has no such day of month' do
15
15
  expect(d1.get_next_date_from_date_of_month(31)).to be nil
16
16
  end
17
17
  end
18
18
 
19
- describe "#test_get_date_from_day_and_week_of_month" do
19
+ describe '#test_get_date_from_day_and_week_of_month' do
20
20
  let(:d1) { ZDate.new('20090927') }
21
21
 
22
- context "passed a negative number" do
23
- it "is the nth-last occurance of that day of the week that month" do
22
+ context 'passed a negative number' do
23
+ it 'is the nth-last occurance of that day of the week that month' do
24
24
  expect(d1.get_date_from_day_and_week_of_month(ZDate::WED, -1)).to eq ZDate.new('20090930')
25
25
  end
26
26
  end
27
27
 
28
- context "passed a positive number" do
29
- it "is the nth occurance of that day of the week that month" do
28
+ context 'passed a positive number' do
29
+ it 'is the nth occurance of that day of the week that month' do
30
30
  expect(d1.get_date_from_day_and_week_of_month(ZDate::WED, 5)).to eq ZDate.new('20090930')
31
31
  end
32
32
 
33
- it "flows on into the next month if there are not enough days that month" do
33
+ it 'flows on into the next month if there are not enough days that month' do
34
34
  expect(d1.get_date_from_day_and_week_of_month(ZDate::THU, 5)).to eq ZDate.new('20091001')
35
35
  end
36
36
  end
37
37
  end
38
38
 
39
- describe "#diff_in_days_to_this" do
40
- let(:d1) { ZDate.new("20090927") }
41
- let(:d2) { ZDate.new("20090930") }
39
+ describe '#diff_in_days_to_this' do
40
+ let(:d1) { ZDate.new('20090927') }
41
+ let(:d2) { ZDate.new('20090930') }
42
42
 
43
- context "passed a weekend date" do
44
- it "is the number of days until that day of the week" do
43
+ context 'passed a weekend date' do
44
+ it 'is the number of days until that day of the week' do
45
45
  expect(d1.diff_in_days_to_this(ZDate::SUN)).to eq 0
46
46
  expect(d1.diff_in_days_to_this(ZDate::MON)).to eq 1
47
47
  expect(d1.diff_in_days_to_this(ZDate::TUE)).to eq 2
@@ -52,8 +52,8 @@ module Nickel
52
52
  end
53
53
  end
54
54
 
55
- context "passed a midweek date" do
56
- it "is the number of days until that day of the week" do
55
+ context 'passed a midweek date' do
56
+ it 'is the number of days until that day of the week' do
57
57
  expect(d2.diff_in_days_to_this(ZDate::WED)).to eq 0
58
58
  expect(d2.diff_in_days_to_this(ZDate::THU)).to eq 1
59
59
  expect(d2.diff_in_days_to_this(ZDate::FRI)).to eq 2
@@ -65,34 +65,54 @@ module Nickel
65
65
  end
66
66
  end
67
67
 
68
- describe "#to_date" do
69
- it "converts to a Date" do
68
+ describe '#to_date' do
69
+ it 'converts to a Date' do
70
70
  expect(ZDate.new('20090927').to_date).to eq Date.new(2009, 9, 27)
71
71
  end
72
72
  end
73
73
 
74
- describe "#==" do
74
+ describe '#==' do
75
75
  let(:d1) { ZDate.new('20090927') }
76
76
 
77
- it "is true when the other ZDate is for the very same day" do
77
+ it 'is true when the other ZDate is for the very same day' do
78
78
  expect(d1).to eq ZDate.new('20090927')
79
79
  end
80
80
 
81
- it "is false when the other ZDate is for any other day" do
81
+ it 'is false when the other ZDate is for any other day' do
82
82
  expect(d1).to_not eq ZDate.new('20100927')
83
83
  end
84
84
 
85
- it "is true when the other object a Date for the same day" do
85
+ it 'is true when the other object a Date for the same day' do
86
86
  expect(d1).to eq Date.new(2009, 9, 27)
87
87
  end
88
88
 
89
- it "is false when the other object is a Date for any other day" do
89
+ it 'is false when the other object is a Date for any other day' do
90
90
  expect(d1).to_not eq Date.new(2010, 9, 27)
91
91
  end
92
92
 
93
- it "is false when the other object is a String" do
93
+ it 'is false when the other object is a String' do
94
94
  expect(d1).to_not eq '20090927'
95
95
  end
96
96
  end
97
+
98
+ describe '#is_today?', :deprecated do
99
+ it "is true when the ZDate is today's date" do
100
+ expect(ZDate.new.is_today?).to eq true
101
+ end
102
+ end
103
+
104
+ describe '#today?' do
105
+ it "is true when the ZDate is today's date" do
106
+ expect(ZDate.new.today?).to eq true
107
+ end
108
+
109
+ it 'is false when the ZDate is in the past' do
110
+ expect(ZDate.new('20090927').today?).to eq false
111
+ end
112
+
113
+ it 'is false when the ZDate is in the future' do
114
+ expect(ZDate.new('21000927').today?).to eq false
115
+ end
116
+ end
97
117
  end
98
118
  end
@@ -1,322 +1,338 @@
1
- require "spec_helper"
2
- require_relative "../../../lib/nickel/ztime"
1
+ require 'spec_helper'
2
+ require_relative '../../../lib/nickel/ztime'
3
3
 
4
4
  module Nickel
5
5
  describe ZTime do
6
- describe "#modify_such_that_is_before" do
7
- specify "1200 to before 1200am is 1200" do
8
- expect(ZTime.new("1200").modify_such_that_is_before(ZTime.new("1200", :am))).to eq ZTime.new("1200")
6
+ describe '#modify_such_that_is_before' do
7
+ specify '1200 to before 1200am is 1200' do
8
+ expect(ZTime.new('1200').modify_such_that_is_before(ZTime.new('1200', :am))).to eq ZTime.new('1200')
9
9
  end
10
10
 
11
- specify "1200 to before 1200pm is 1200am" do
12
- expect(ZTime.new("1200").modify_such_that_is_before(ZTime.new("1200", :pm))).to eq ZTime.new("1200", :am)
11
+ specify '1200 to before 1200pm is 1200am' do
12
+ expect(ZTime.new('1200').modify_such_that_is_before(ZTime.new('1200', :pm))).to eq ZTime.new('1200', :am)
13
13
  end
14
14
 
15
- specify "1 to before 2am is 1" do
16
- expect(ZTime.new("1").modify_such_that_is_before(ZTime.new("2", :am))).to eq ZTime.new("1")
15
+ specify '1 to before 2am is 1' do
16
+ expect(ZTime.new('1').modify_such_that_is_before(ZTime.new('2', :am))).to eq ZTime.new('1')
17
17
  end
18
18
 
19
- specify "10 to before 11pm is 10pm" do
20
- expect(ZTime.new("10").modify_such_that_is_before(ZTime.new("11", :pm))).to eq ZTime.new("10", :pm)
19
+ specify '10 to before 11pm is 10pm' do
20
+ expect(ZTime.new('10').modify_such_that_is_before(ZTime.new('11', :pm))).to eq ZTime.new('10', :pm)
21
21
  end
22
22
 
23
- specify "8 to before 11pm is 8" do
24
- expect(ZTime.new("8").modify_such_that_is_before(ZTime.new("12", :pm))).to eq ZTime.new("8")
23
+ specify '8 to before 11pm is 8' do
24
+ expect(ZTime.new('8').modify_such_that_is_before(ZTime.new('12', :pm))).to eq ZTime.new('8')
25
25
  end
26
26
 
27
- specify "0830 to before 0835am is 0830" do
28
- expect(ZTime.new("0830").modify_such_that_is_before(ZTime.new("0835", :am))).to eq ZTime.new("0830")
27
+ specify '0830 to before 0835am is 0830' do
28
+ expect(ZTime.new('0830').modify_such_that_is_before(ZTime.new('0835', :am))).to eq ZTime.new('0830')
29
29
  end
30
30
 
31
- specify "0830 to before 0835pm is 0830pm" do
32
- expect(ZTime.new("0830").modify_such_that_is_before(ZTime.new("0835", :pm))).to eq ZTime.new("0830", :pm)
31
+ specify '0830 to before 0835pm is 0830pm' do
32
+ expect(ZTime.new('0830').modify_such_that_is_before(ZTime.new('0835', :pm))).to eq ZTime.new('0830', :pm)
33
33
  end
34
34
 
35
- specify "0835 to before 0835pm is 0835" do
36
- expect(ZTime.new("0835").modify_such_that_is_before(ZTime.new("0835", :pm))).to eq ZTime.new("0835")
35
+ specify '0835 to before 0835pm is 0835' do
36
+ expect(ZTime.new('0835').modify_such_that_is_before(ZTime.new('0835', :pm))).to eq ZTime.new('0835')
37
37
  end
38
38
 
39
- specify "1021 to before 1223am is 1021pm" do
40
- expect(ZTime.new("1021").modify_such_that_is_before(ZTime.new("1223", :am))).to eq ZTime.new("1021", :pm)
39
+ specify '1021 to before 1223am is 1021pm' do
40
+ expect(ZTime.new('1021').modify_such_that_is_before(ZTime.new('1223', :am))).to eq ZTime.new('1021', :pm)
41
41
  end
42
42
 
43
- specify "12 to before 2am is 12am" do
44
- expect(ZTime.new("12").modify_such_that_is_before(ZTime.new("2", :am))).to eq ZTime.new("12", :am)
43
+ specify '12 to before 2am is 12am' do
44
+ expect(ZTime.new('12').modify_such_that_is_before(ZTime.new('2', :am))).to eq ZTime.new('12', :am)
45
45
  end
46
46
 
47
- specify "1220 to before 2am is 1220am" do
48
- expect(ZTime.new("1220").modify_such_that_is_before(ZTime.new("2", :am))).to eq ZTime.new("1220", :am)
47
+ specify '1220 to before 2am is 1220am' do
48
+ expect(ZTime.new('1220').modify_such_that_is_before(ZTime.new('2', :am))).to eq ZTime.new('1220', :am)
49
49
  end
50
50
 
51
- specify "1220 to before 12am is 1220" do
52
- expect(ZTime.new("1220").modify_such_that_is_before(ZTime.new("12", :am))).to eq ZTime.new("1220")
51
+ specify '1220 to before 12am is 1220' do
52
+ expect(ZTime.new('1220').modify_such_that_is_before(ZTime.new('12', :am))).to eq ZTime.new('1220')
53
53
  end
54
54
 
55
- specify "1220 to before 1220am is 1220" do
56
- expect(ZTime.new("1220").modify_such_that_is_before(ZTime.new("1220", :am))).to eq ZTime.new("1220")
55
+ specify '1220 to before 1220am is 1220' do
56
+ expect(ZTime.new('1220').modify_such_that_is_before(ZTime.new('1220', :am))).to eq ZTime.new('1220')
57
57
  end
58
58
 
59
- specify "0930 to before 5pm is 0930" do
60
- expect(ZTime.new("0930").modify_such_that_is_before(ZTime.new("5", :pm))).to eq ZTime.new("0930")
59
+ specify '0930 to before 5pm is 0930' do
60
+ expect(ZTime.new('0930').modify_such_that_is_before(ZTime.new('5', :pm))).to eq ZTime.new('0930')
61
61
  end
62
62
 
63
- specify "0930 to before 5am is 0930pm" do
64
- expect(ZTime.new("0930").modify_such_that_is_before(ZTime.new("5", :am))).to eq ZTime.new("0930", :pm)
63
+ specify '0930 to before 5am is 0930pm' do
64
+ expect(ZTime.new('0930').modify_such_that_is_before(ZTime.new('5', :am))).to eq ZTime.new('0930', :pm)
65
65
  end
66
66
 
67
- specify "1100 to before 0425pm is 1100" do
68
- expect(ZTime.new("1100").modify_such_that_is_before(ZTime.new("0425", :pm))).to eq ZTime.new("1100")
67
+ specify '1100 to before 0425pm is 1100' do
68
+ expect(ZTime.new('1100').modify_such_that_is_before(ZTime.new('0425', :pm))).to eq ZTime.new('1100')
69
69
  end
70
70
 
71
- specify "1100 to before 0425am is 1100pm" do
72
- expect(ZTime.new("1100").modify_such_that_is_before(ZTime.new("0425", :am))).to eq ZTime.new("1100", :pm)
71
+ specify '1100 to before 0425am is 1100pm' do
72
+ expect(ZTime.new('1100').modify_such_that_is_before(ZTime.new('0425', :am))).to eq ZTime.new('1100', :pm)
73
73
  end
74
74
 
75
- specify "0115 to before 0120am is 0115" do
76
- expect(ZTime.new("0115").modify_such_that_is_before(ZTime.new("0120", :am))).to eq ZTime.new("0115")
75
+ specify '0115 to before 0120am is 0115' do
76
+ expect(ZTime.new('0115').modify_such_that_is_before(ZTime.new('0120', :am))).to eq ZTime.new('0115')
77
77
  end
78
78
 
79
- specify "0115 to before 0120pm is 0115pm" do
80
- expect(ZTime.new("0115").modify_such_that_is_before(ZTime.new("0120", :pm))).to eq ZTime.new("0115", :pm)
79
+ specify '0115 to before 0120pm is 0115pm' do
80
+ expect(ZTime.new('0115').modify_such_that_is_before(ZTime.new('0120', :pm))).to eq ZTime.new('0115', :pm)
81
81
  end
82
82
 
83
- specify "1020 to before 1015am is 1020pm" do
84
- expect(ZTime.new("1020").modify_such_that_is_before(ZTime.new("1015", :am))).to eq ZTime.new("1020", :pm)
83
+ specify '1020 to before 1015am is 1020pm' do
84
+ expect(ZTime.new('1020').modify_such_that_is_before(ZTime.new('1015', :am))).to eq ZTime.new('1020', :pm)
85
85
  end
86
86
 
87
- specify "1020 to before 1015pm is 1020" do
88
- expect(ZTime.new("1020").modify_such_that_is_before(ZTime.new("1015", :pm))).to eq ZTime.new("1020")
87
+ specify '1020 to before 1015pm is 1020' do
88
+ expect(ZTime.new('1020').modify_such_that_is_before(ZTime.new('1015', :pm))).to eq ZTime.new('1020')
89
89
  end
90
90
 
91
- specify "1015 to before 1020am is 1015" do
92
- expect(ZTime.new("1015").modify_such_that_is_before(ZTime.new("1020", :am))).to eq ZTime.new("1015")
91
+ specify '1015 to before 1020am is 1015' do
92
+ expect(ZTime.new('1015').modify_such_that_is_before(ZTime.new('1020', :am))).to eq ZTime.new('1015')
93
93
  end
94
94
 
95
- specify "1015 to before 1020pm is 1015pm" do
96
- expect(ZTime.new("1015").modify_such_that_is_before(ZTime.new("1020", :pm))).to eq ZTime.new("1015", :pm)
95
+ specify '1015 to before 1020pm is 1015pm' do
96
+ expect(ZTime.new('1015').modify_such_that_is_before(ZTime.new('1020', :pm))).to eq ZTime.new('1015', :pm)
97
97
  end
98
98
  end
99
99
 
100
- describe "#modify_such_that_is_after" do
101
- specify "1200 to after 1200am is 1200am" do
102
- expect(ZTime.new("1200").modify_such_that_is_after(ZTime.new("1200", :pm))).to eq ZTime.new("1200", :am)
100
+ describe '#modify_such_that_is_after' do
101
+ specify '1200 to after 1200am is 1200am' do
102
+ expect(ZTime.new('1200').modify_such_that_is_after(ZTime.new('1200', :pm))).to eq ZTime.new('1200', :am)
103
103
  end
104
104
 
105
- specify "1200 to after 1200am is 1200" do
106
- expect(ZTime.new("1200").modify_such_that_is_after(ZTime.new("1200", :am))).to eq ZTime.new("1200")
105
+ specify '1200 to after 1200am is 1200' do
106
+ expect(ZTime.new('1200').modify_such_that_is_after(ZTime.new('1200', :am))).to eq ZTime.new('1200')
107
107
  end
108
108
 
109
- specify "2 to after 1am is 2" do
110
- expect(ZTime.new("2").modify_such_that_is_after(ZTime.new("1", :am))).to eq ZTime.new("2")
109
+ specify '2 to after 1am is 2' do
110
+ expect(ZTime.new('2').modify_such_that_is_after(ZTime.new('1', :am))).to eq ZTime.new('2')
111
111
  end
112
112
 
113
- specify "11 to after 10pm is 11pm" do
114
- expect(ZTime.new("11").modify_such_that_is_after(ZTime.new("10", :pm))).to eq ZTime.new("11", :pm)
113
+ specify '11 to after 10pm is 11pm' do
114
+ expect(ZTime.new('11').modify_such_that_is_after(ZTime.new('10', :pm))).to eq ZTime.new('11', :pm)
115
115
  end
116
116
 
117
- specify "12 to after 8am is 12" do
118
- expect(ZTime.new("12").modify_such_that_is_after(ZTime.new("8", :am))).to eq ZTime.new("12")
117
+ specify '12 to after 8am is 12' do
118
+ expect(ZTime.new('12').modify_such_that_is_after(ZTime.new('8', :am))).to eq ZTime.new('12')
119
119
  end
120
120
 
121
- specify "0835 to after 0830am is 0835" do
122
- expect(ZTime.new("0835").modify_such_that_is_after(ZTime.new("0830", :am))).to eq ZTime.new("0835")
121
+ specify '0835 to after 0830am is 0835' do
122
+ expect(ZTime.new('0835').modify_such_that_is_after(ZTime.new('0830', :am))).to eq ZTime.new('0835')
123
123
  end
124
124
 
125
- specify "0835 to after 0830pm is 0835pm" do
126
- expect(ZTime.new("0835").modify_such_that_is_after(ZTime.new("0830", :pm))).to eq ZTime.new("0835", :pm)
125
+ specify '0835 to after 0830pm is 0835pm' do
126
+ expect(ZTime.new('0835').modify_such_that_is_after(ZTime.new('0830', :pm))).to eq ZTime.new('0835', :pm)
127
127
  end
128
128
 
129
- specify "0835 to after 0835am is 0835pm" do
130
- expect(ZTime.new("0835").modify_such_that_is_after(ZTime.new("0835", :am))).to eq ZTime.new("0835", :pm)
129
+ specify '0835 to after 0835am is 0835pm' do
130
+ expect(ZTime.new('0835').modify_such_that_is_after(ZTime.new('0835', :am))).to eq ZTime.new('0835', :pm)
131
131
  end
132
132
 
133
- specify "0835 to after 0835pm is 0835" do
134
- expect(ZTime.new("0835").modify_such_that_is_after(ZTime.new("0835", :pm))).to eq ZTime.new("0835")
133
+ specify '0835 to after 0835pm is 0835' do
134
+ expect(ZTime.new('0835').modify_such_that_is_after(ZTime.new('0835', :pm))).to eq ZTime.new('0835')
135
135
  end
136
136
 
137
- specify "1223 to after 1021pm is 1223am" do
138
- expect(ZTime.new("1223").modify_such_that_is_after(ZTime.new("1021", :pm))).to eq ZTime.new("1223", :am)
137
+ specify '1223 to after 1021pm is 1223am' do
138
+ expect(ZTime.new('1223').modify_such_that_is_after(ZTime.new('1021', :pm))).to eq ZTime.new('1223', :am)
139
139
  end
140
140
 
141
- specify "2 to after 12am is 2" do
142
- expect(ZTime.new("2").modify_such_that_is_after(ZTime.new("12", :am))).to eq ZTime.new("2")
141
+ specify '2 to after 12am is 2' do
142
+ expect(ZTime.new('2').modify_such_that_is_after(ZTime.new('12', :am))).to eq ZTime.new('2')
143
143
  end
144
144
 
145
- specify "2 to after 1220am is 2" do
146
- expect(ZTime.new("2").modify_such_that_is_after(ZTime.new("1220", :am))).to eq ZTime.new("2")
145
+ specify '2 to after 1220am is 2' do
146
+ expect(ZTime.new('2').modify_such_that_is_after(ZTime.new('1220', :am))).to eq ZTime.new('2')
147
147
  end
148
148
 
149
- specify "12 to after 1220am is 12" do
150
- expect(ZTime.new("12").modify_such_that_is_after(ZTime.new("1220", :am))).to eq ZTime.new("12")
149
+ specify '12 to after 1220am is 12' do
150
+ expect(ZTime.new('12').modify_such_that_is_after(ZTime.new('1220', :am))).to eq ZTime.new('12')
151
151
  end
152
152
 
153
- specify "1220 to after 1220pm is 1220am" do
154
- expect(ZTime.new("1220").modify_such_that_is_after(ZTime.new("1220", :pm))).to eq ZTime.new("1220", :am)
153
+ specify '1220 to after 1220pm is 1220am' do
154
+ expect(ZTime.new('1220').modify_such_that_is_after(ZTime.new('1220', :pm))).to eq ZTime.new('1220', :am)
155
155
  end
156
156
 
157
- specify "5 to after 0930am is 5pm" do
158
- expect(ZTime.new("5").modify_such_that_is_after(ZTime.new("0930", :am))).to eq ZTime.new("5", :pm)
157
+ specify '5 to after 0930am is 5pm' do
158
+ expect(ZTime.new('5').modify_such_that_is_after(ZTime.new('0930', :am))).to eq ZTime.new('5', :pm)
159
159
  end
160
160
 
161
- specify "5 to after 0930pm is 5" do
162
- expect(ZTime.new("5").modify_such_that_is_after(ZTime.new("0930", :pm))).to eq ZTime.new("5")
161
+ specify '5 to after 0930pm is 5' do
162
+ expect(ZTime.new('5').modify_such_that_is_after(ZTime.new('0930', :pm))).to eq ZTime.new('5')
163
163
  end
164
164
 
165
- specify "0425 to after 1100am is 0425pm" do
166
- expect(ZTime.new("0425").modify_such_that_is_after(ZTime.new("1100", :am))).to eq ZTime.new("0425", :pm)
165
+ specify '0425 to after 1100am is 0425pm' do
166
+ expect(ZTime.new('0425').modify_such_that_is_after(ZTime.new('1100', :am))).to eq ZTime.new('0425', :pm)
167
167
  end
168
168
 
169
- specify "0425 to after 1100pm is 0425" do
170
- expect(ZTime.new("0425").modify_such_that_is_after(ZTime.new("1100", :pm))).to eq ZTime.new("0425")
169
+ specify '0425 to after 1100pm is 0425' do
170
+ expect(ZTime.new('0425').modify_such_that_is_after(ZTime.new('1100', :pm))).to eq ZTime.new('0425')
171
171
  end
172
172
 
173
- specify "0120 to after 0115am is 0120" do
174
- expect(ZTime.new("0120").modify_such_that_is_after(ZTime.new("0115", :am))).to eq ZTime.new("0120")
173
+ specify '0120 to after 0115am is 0120' do
174
+ expect(ZTime.new('0120').modify_such_that_is_after(ZTime.new('0115', :am))).to eq ZTime.new('0120')
175
175
  end
176
176
 
177
- specify "0120 to after 0115pm is 0120pm" do
178
- expect(ZTime.new("0120").modify_such_that_is_after(ZTime.new("0115", :pm))).to eq ZTime.new("0120", :pm)
177
+ specify '0120 to after 0115pm is 0120pm' do
178
+ expect(ZTime.new('0120').modify_such_that_is_after(ZTime.new('0115', :pm))).to eq ZTime.new('0120', :pm)
179
179
  end
180
180
 
181
- specify "1015 to after 1020pm is 1015" do
182
- expect(ZTime.new("1015").modify_such_that_is_after(ZTime.new("1020", :pm))).to eq ZTime.new("1015")
181
+ specify '1015 to after 1020pm is 1015' do
182
+ expect(ZTime.new('1015').modify_such_that_is_after(ZTime.new('1020', :pm))).to eq ZTime.new('1015')
183
183
  end
184
184
 
185
- specify "1015 to after 1020am is 1015pm" do
186
- expect(ZTime.new("1015").modify_such_that_is_after(ZTime.new("1020", :am))).to eq ZTime.new("1015", :pm)
185
+ specify '1015 to after 1020am is 1015pm' do
186
+ expect(ZTime.new('1015').modify_such_that_is_after(ZTime.new('1020', :am))).to eq ZTime.new('1015', :pm)
187
187
  end
188
188
 
189
- specify "1020 to after 1015pm is 1020pm" do
190
- expect(ZTime.new("1020").modify_such_that_is_after(ZTime.new("1015", :pm))).to eq ZTime.new("1020", :pm)
189
+ specify '1020 to after 1015pm is 1020pm' do
190
+ expect(ZTime.new('1020').modify_such_that_is_after(ZTime.new('1015', :pm))).to eq ZTime.new('1020', :pm)
191
191
  end
192
192
 
193
- specify "1020 to after 1015am is 1020" do
194
- expect(ZTime.new("1020").modify_such_that_is_after(ZTime.new("1015", :am))).to eq ZTime.new("1020")
193
+ specify '1020 to after 1015am is 1020' do
194
+ expect(ZTime.new('1020').modify_such_that_is_after(ZTime.new('1015', :am))).to eq ZTime.new('1020')
195
195
  end
196
196
  end
197
197
 
198
- describe "#am_pm_modifier" do
198
+ describe '#am_pm_modifier' do
199
199
 
200
- context "passed one ztime" do
201
- it "sets am/pm if not set" do
202
- t = ZTime.new("7", :pm)
200
+ context 'passed one ztime' do
201
+ it 'sets am/pm if not set' do
202
+ t = ZTime.new('7', :pm)
203
203
  ZTime.am_pm_modifier(t)
204
- expect(t).to eq ZTime.new("7", :pm)
204
+ expect(t).to eq ZTime.new('7', :pm)
205
205
  end
206
206
  end
207
207
 
208
- context "passed two ztimes" do
209
- it "sets am/pm if not set" do
210
- tz = [ZTime.new("7", :pm), ZTime.new("8")]
208
+ context 'passed two ztimes' do
209
+ it 'sets am/pm if not set' do
210
+ tz = [ZTime.new('7', :pm), ZTime.new('8')]
211
211
  ZTime.am_pm_modifier(*tz)
212
- expect(tz).to eq [ZTime.new("7", :pm), ZTime.new("8", :pm)]
212
+ expect(tz).to eq [ZTime.new('7', :pm), ZTime.new('8', :pm)]
213
213
  end
214
214
  end
215
215
 
216
- context "passed three ztimes" do
217
- it "sets am/pm if not set" do
218
- tz = [ZTime.new("7", :pm), ZTime.new("8", :pm), ZTime.new("9")]
216
+ context 'passed three ztimes' do
217
+ it 'sets am/pm if not set' do
218
+ tz = [ZTime.new('7', :pm), ZTime.new('8', :pm), ZTime.new('9')]
219
219
  ZTime.am_pm_modifier(*tz)
220
- expect(tz).to eq [ZTime.new("7", :pm), ZTime.new("8", :pm), ZTime.new("9", :pm)]
220
+ expect(tz).to eq [ZTime.new('7', :pm), ZTime.new('8', :pm), ZTime.new('9', :pm)]
221
221
  end
222
222
  end
223
223
 
224
- context "passed five ztimes" do
225
- it "sets am/pm if not set" do
226
- tz = [ZTime.new("7"), ZTime.new("8", :am), ZTime.new("9"), ZTime.new("4", :pm), ZTime.new("7")]
224
+ context 'passed five ztimes' do
225
+ it 'sets am/pm if not set' do
226
+ tz = [ZTime.new('7'), ZTime.new('8', :am), ZTime.new('9'), ZTime.new('4', :pm), ZTime.new('7')]
227
227
  ZTime.am_pm_modifier(*tz)
228
- expect(tz).to eq [ZTime.new("7", :am), ZTime.new("8", :am), ZTime.new("9", :am), ZTime.new("4", :pm), ZTime.new("7", :pm)]
228
+ expect(tz).to eq [ZTime.new('7', :am), ZTime.new('8', :am), ZTime.new('9', :am), ZTime.new('4', :pm), ZTime.new('7', :pm)]
229
229
  end
230
230
  end
231
231
  end
232
232
 
233
- describe "#to_time" do
234
- it "converts to a Time on todays date" do
235
- expect(ZTime.new("161718").to_time).to eq Time.parse("16:17:18")
233
+ describe '#to_time' do
234
+ it 'converts to a Time on todays date' do
235
+ expect(ZTime.new('161718').to_time).to eq Time.parse('16:17:18')
236
236
  end
237
237
  end
238
238
 
239
- describe "#==" do
240
- let(:t1) { ZTime.new("161718") }
239
+ describe '#==' do
240
+ let(:t1) { ZTime.new('161718') }
241
241
 
242
- it "is true when the other ZTime is for the very same time of day" do
242
+ it 'is true when the other ZTime is for the very same time of day' do
243
243
  expect(t1).to eq ZTime.new('161718')
244
244
  end
245
245
 
246
- it "is false when the other ZTime is for any other time" do
246
+ it 'is false when the other ZTime is for any other time' do
247
247
  expect(t1).to_not eq ZTime.new('171819')
248
248
  end
249
249
 
250
- it "is true when the other object is a Time for the same time of day" do
251
- expect(t1).to eq Time.parse("16:17:18")
250
+ it 'is true when the other object is a Time for the same time of day' do
251
+ expect(t1).to eq Time.parse('16:17:18')
252
252
  end
253
253
 
254
- it "is false when the other object is a Time for any other time" do
255
- expect(t1).to_not eq Time.parse("17:18:19")
254
+ it 'is false when the other object is a Time for any other time' do
255
+ expect(t1).to_not eq Time.parse('17:18:19')
256
256
  end
257
257
 
258
- it "is false when the other object is a String" do
259
- expect(t1).to_not eq "161718"
258
+ it 'is false when the other object is a String' do
259
+ expect(t1).to_not eq '161718'
260
260
  end
261
261
  end
262
262
 
263
- describe "#hour_str" do
264
- it "is the hour in the day as a string" do
265
- expect(ZTime.new("161718").hour_str).to eq("16")
263
+ describe '#hour_str' do
264
+ it 'is the hour in the day as a string' do
265
+ expect(ZTime.new('161718').hour_str).to eq('16')
266
266
  end
267
267
  end
268
268
 
269
- describe "#min_str" do
270
- it "is the minutes past the hour as a string" do
271
- expect(ZTime.new("161718").min_str).to eq("17")
269
+ describe '#min_str' do
270
+ it 'is the minutes past the hour as a string' do
271
+ expect(ZTime.new('161718').min_str).to eq('17')
272
272
  end
273
273
  end
274
274
 
275
- describe "#sec_str" do
276
- it "is the seconds into the minute as a string" do
277
- expect(ZTime.new("161718").sec_str).to eq("18")
275
+ describe '#sec_str' do
276
+ it 'is the seconds into the minute as a string' do
277
+ expect(ZTime.new('161718').sec_str).to eq('18')
278
278
  end
279
279
  end
280
280
 
281
- describe "#minute_str", :deprecated do
282
- it "is the minutes past the hour as a string" do
283
- expect(ZTime.new("161718").min_str).to eq("17")
281
+ describe '#minute_str', :deprecated do
282
+ it 'is the minutes past the hour as a string' do
283
+ expect(ZTime.new('161718').min_str).to eq('17')
284
284
  end
285
285
  end
286
286
 
287
- describe "#second_str", :deprecated do
288
- it "is the seconds into the minute as a string" do
289
- expect(ZTime.new("161718").sec_str).to eq("18")
287
+ describe '#second_str', :deprecated do
288
+ it 'is the seconds into the minute as a string' do
289
+ expect(ZTime.new('161718').sec_str).to eq('18')
290
290
  end
291
291
  end
292
292
 
293
- describe "#hour" do
294
- it "is the hour in the day" do
295
- expect(ZTime.new("161718").hour).to eq(16)
293
+ describe '#hour' do
294
+ it 'is the hour in the day' do
295
+ expect(ZTime.new('161718').hour).to eq(16)
296
296
  end
297
297
  end
298
298
 
299
- describe "#min" do
300
- it "is the minutes past the hour" do
301
- expect(ZTime.new("161718").min).to eq(17)
299
+ describe '#min' do
300
+ it 'is the minutes past the hour' do
301
+ expect(ZTime.new('161718').min).to eq(17)
302
302
  end
303
303
  end
304
304
 
305
- describe "#sec" do
306
- it "is the seconds into the minute" do
307
- expect(ZTime.new("161718").sec).to eq(18)
305
+ describe '#sec' do
306
+ it 'is the seconds into the minute' do
307
+ expect(ZTime.new('161718').sec).to eq(18)
308
308
  end
309
309
  end
310
310
 
311
- describe "#minute", :deprecated do
312
- it "is the minutes past the hour" do
313
- expect(ZTime.new("161718").min).to eq(17)
311
+ describe '#minute', :deprecated do
312
+ it 'is the minutes past the hour' do
313
+ expect(ZTime.new('161718').min).to eq(17)
314
314
  end
315
315
  end
316
316
 
317
- describe "#second", :deprecated do
318
- it "is the seconds into the minute" do
319
- expect(ZTime.new("161718").sec).to eq(18)
317
+ describe '#second', :deprecated do
318
+ it 'is the seconds into the minute' do
319
+ expect(ZTime.new('161718').sec).to eq(18)
320
+ end
321
+ end
322
+
323
+ describe '#is_am?', :deprecated do
324
+ it 'is true when the ZTime is before 12:00' do
325
+ expect(ZTime.new('110000').is_am?).to eq(true)
326
+ end
327
+ end
328
+
329
+ describe '#am?' do
330
+ it 'is true when the ZTime is before 12:00' do
331
+ expect(ZTime.new('110000').am?).to eq(true)
332
+ end
333
+
334
+ it 'is false when the ZTime is on or after 12:00' do
335
+ expect(ZTime.new('120000').am?).to eq(false)
320
336
  end
321
337
  end
322
338
  end