timelord 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/timelord.rb +1 -1
  3. data/spec/timelord_spec.rb +35 -35
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 60169c613d4bfbc330e87f3bd81f39bd07c1a7cc
4
- data.tar.gz: 184555c3231a91a8a3057dacfb1fa527fc176967
3
+ metadata.gz: 5189616e2ec6e2f443d70bf1aa8140650178939a
4
+ data.tar.gz: 6e9bc68cbd8295504d112d7fbeb1b4037537c7a7
5
5
  SHA512:
6
- metadata.gz: baf409a8ef5a0dcd8a42683bf2e52f9c9b8d811f29cf7eb326cc30d04a2ce4b06cfe3231e5ff87a0589ed4ded915c79384b3f410a851364a5d0f2268a0996aa5
7
- data.tar.gz: 732b6c734a74ee0a40cf638f92ea4fceecbef9c9a7471012153b4b2dcbae48cab1be6302648d1f387429a101b287136d287a710c5808333693a55b7d4d3f7663
6
+ metadata.gz: 33b865effef5a4b9a072d51d32b296944c5043d9edffe0f705f1e4ef0e2d68499c7a9d51a250f2fc8055f15fb43aec76b4aedbd357c6d43abc69b1a450e951eb
7
+ data.tar.gz: 1d80dec16533705248e527c9292803e6f277d89384b492557f7b02abd907b764715300a02d7432cc37769219cf311b9b31c5dd5d1aebfb0bf9c95430876c041b
@@ -8,7 +8,7 @@ require 'timelord/current_weekday'
8
8
  require 'timelord/matcher_loader'
9
9
 
10
10
  module Timelord
11
- VERSION = "0.0.11"
11
+ VERSION = "0.0.12"
12
12
 
13
13
  # Parses a date str. Second parameter switches between international and american date formats.
14
14
  #
@@ -8,81 +8,81 @@ describe Timelord, 'parse' do
8
8
 
9
9
  it "can set today to a different value" do
10
10
  actual_date = Time.local(2010,12,5,10,5,0)
11
- Timelord.parse("today", today: actual_date).should == actual_date
11
+ expect(Timelord.parse("today", today: actual_date)).to eq actual_date
12
12
  end
13
13
 
14
14
  it "returns nil when no time is present" do
15
- Timelord.parse("No time here").should == nil
15
+ expect(Timelord.parse("No time here")).to eq nil
16
16
  end
17
17
 
18
18
  it "parses 'today'" do
19
- Timelord.parse("I need to do something today.").should == Date.today
19
+ expect(Timelord.parse("I need to do something today.")).to eq Date.today
20
20
  end
21
21
 
22
22
  it "parses 'tod'" do
23
- Timelord.parse("I need to do something tod.").should == Date.today
23
+ expect(Timelord.parse("I need to do something tod.")).to eq Date.today
24
24
  end
25
25
 
26
26
  it "parses 'tomorrow'" do
27
27
  tomorrow = Date.today + 1
28
- Timelord.parse("I need to do something tomorrow.").should == tomorrow
28
+ expect(Timelord.parse("I need to do something tomorrow.")).to eq tomorrow
29
29
  end
30
30
 
31
31
  it "parses 'tom'" do
32
32
  tomorrow = Date.today + 1
33
- Timelord.parse("I need to do something tom.").should == tomorrow
33
+ expect(Timelord.parse("I need to do something tom.")).to eq tomorrow
34
34
  end
35
35
 
36
36
  it "does not parse 'monster' as monday" do
37
- Timelord.parse("Monster mash").should == nil
37
+ expect(Timelord.parse("Monster mash")).to eq nil
38
38
  end
39
39
 
40
40
  it "parses '12 Dec'" do
41
41
  twelth_of_december = Date.civil(2010,12,12)
42
- Timelord.parse("On 12 Dec I need to do something.").should == twelth_of_december
42
+ expect(Timelord.parse("On 12 Dec I need to do something.")).to eq twelth_of_december
43
43
  end
44
44
 
45
45
  it "parses 'Dec 12'" do
46
46
  twelth_of_december = Date.civil(2010,12,12)
47
- Timelord.parse("On Dec 12 I need to do something.").should == twelth_of_december
47
+ expect(Timelord.parse("On Dec 12 I need to do something.")).to eq twelth_of_december
48
48
  end
49
49
 
50
50
  it "parses American style dates" do
51
51
  first_of_december = Date.today
52
- Timelord.parse("On 12/1/2010 I need to do something.", format: :american).should == first_of_december
52
+ expect(Timelord.parse("On 12/1/2010 I need to do something.", format: :american)).to eq first_of_december
53
53
  end
54
54
 
55
55
  it "parses Internation style dates by default" do
56
56
  first_of_december = Date.today
57
- Timelord.parse("On 1/12/2010 I need to do something.", format: :international).should == first_of_december
57
+ expect(Timelord.parse("On 1/12/2010 I need to do something.", format: :international)).to eq first_of_december
58
58
  end
59
59
 
60
60
  it "parses yyyy/mm/dd" do
61
61
  first_of_december = Date.today
62
- Timelord.parse("On 2010/12/01 I need to do something.").should == first_of_december
62
+ expect(Timelord.parse("On 2010/12/01 I need to do something.")).to eq first_of_december
63
63
  end
64
64
 
65
65
  it "parses yyyy/mm/d" do
66
66
  first_of_december = Date.today
67
- Timelord.parse("On 2010/12/1 I need to do something.").should == first_of_december
67
+ expect(Timelord.parse("On 2010/12/1 I need to do something.")).to eq first_of_december
68
68
  end
69
69
 
70
70
  it "parses yyyy/m/d" do
71
71
  first_of_january = Date.civil(2010, 1, 1)
72
- Timelord.parse("On 2010/1/1 I need to do something.").should == first_of_january
72
+ expect(Timelord.parse("On 2010/1/1 I need to do something.")).to eq first_of_january
73
73
  end
74
74
 
75
75
  it "parses yyyy-mm-dd" do
76
76
  first_of_december = Date.today
77
- Timelord.parse("On 2010-12-01 I need to do something.").should == first_of_december
77
+ expect(Timelord.parse("On 2010-12-01 I need to do something.")).to eq first_of_december
78
78
  end
79
79
 
80
80
  it "parses mm/dd" do
81
81
  first_of_december = Date.today
82
- Timelord.parse("On 12/1 I need to do something.", format: :american).should == first_of_december
83
- Timelord.parse("On 12/01 I need to do something.", format: :american).should == first_of_december
84
- Timelord.parse("On 1/12 I need to do something.", format: :international).should == first_of_december
85
- Timelord.parse("On 01/12 I need to do something.", format: :international).should == first_of_december
82
+ expect(Timelord.parse("On 12/1 I need to do something.", format: :american)).to eq first_of_december
83
+ expect(Timelord.parse("On 12/01 I need to do something.", format: :american)).to eq first_of_december
84
+ expect(Timelord.parse("On 1/12 I need to do something.", format: :international)).to eq first_of_december
85
+ expect(Timelord.parse("On 01/12 I need to do something.", format: :international)).to eq first_of_december
86
86
  end
87
87
 
88
88
  it "parses formats like 1st,2nd,3rd,4th,25th" do
@@ -91,11 +91,11 @@ describe Timelord, 'parse' do
91
91
  third_of_december = Date.today + 2
92
92
  forth_of_december = Date.today + 3
93
93
  twenty_fifth_of_december = Date.civil(2010,12,25)
94
- Timelord.parse("On the 1st").should == first_of_december
95
- Timelord.parse("On the 2nd").should == second_of_december
96
- Timelord.parse("On the 3rd").should == third_of_december
97
- Timelord.parse("On the 4th").should == forth_of_december
98
- Timelord.parse("On the 25th").should == twenty_fifth_of_december
94
+ expect(Timelord.parse("On the 1st")).to eq first_of_december
95
+ expect(Timelord.parse("On the 2nd")).to eq second_of_december
96
+ expect(Timelord.parse("On the 3rd")).to eq third_of_december
97
+ expect(Timelord.parse("On the 4th")).to eq forth_of_december
98
+ expect(Timelord.parse("On the 25th")).to eq twenty_fifth_of_december
99
99
  end
100
100
 
101
101
  it "parses the day of the week" do
@@ -103,34 +103,34 @@ describe Timelord, 'parse' do
103
103
  monday = Date.today + 5
104
104
  tuesday = Date.today + 6
105
105
  thursday = Date.today + 1
106
- Timelord.parse("On friday do something").should == friday
107
- Timelord.parse("On Monday do something").should == monday
108
- Timelord.parse("On fri do something").should == friday
109
- Timelord.parse("On mon do something").should == monday
110
- Timelord.parse("On tues do something").should == tuesday
111
- Timelord.parse("On thurs do something").should == thursday
106
+ expect(Timelord.parse("On friday do something")).to eq friday
107
+ expect(Timelord.parse("On Monday do something")).to eq monday
108
+ expect(Timelord.parse("On fri do something")).to eq friday
109
+ expect(Timelord.parse("On mon do something")).to eq monday
110
+ expect(Timelord.parse("On tues do something")).to eq tuesday
111
+ expect(Timelord.parse("On thurs do something")).to eq thursday
112
112
  end
113
113
 
114
114
  it "parses the next weekday" do
115
115
  friday = Date.today + 9
116
116
  monday = Date.today + 12
117
- Timelord.parse("On next friday do something").should == friday
118
- Timelord.parse("On next Monday do something").should == monday
117
+ expect(Timelord.parse("On next friday do something")).to eq friday
118
+ expect(Timelord.parse("On next Monday do something")).to eq monday
119
119
  end
120
120
 
121
121
  it 'returns a date in the future' do
122
122
  first_of_january = Date.civil(2011,1,1)
123
- Timelord.parse("On 1 Jan I need to do something.").should == first_of_january
123
+ expect(Timelord.parse("On 1 Jan I need to do something.")).to eq first_of_january
124
124
  end
125
125
 
126
126
  it 'parses month_name day format' do
127
127
  first_of_march = Date.civil(2011,3,1)
128
- Timelord.parse("March 1 I need to do stuff.").should == first_of_march
128
+ expect(Timelord.parse("March 1 I need to do stuff.")).to eq first_of_march
129
129
  end
130
130
 
131
131
  it 'parses mm/dd/yy correctly' do
132
132
  oct_12 = Date.civil(2015, 10, 12)
133
- Timelord.parse("Stuff 10/12/15", format: :american).should == oct_12
133
+ expect(Timelord.parse("Stuff 10/12/15", format: :american)).to eq oct_12
134
134
  end
135
135
 
136
136
  after do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timelord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Mongeau