nickel 0.1.3 → 0.1.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f38c33886668bebd4eb80631d91f7deadc47cc1c
4
- data.tar.gz: 3ea91da5a8c4a0318224d3ed2289ffaef00e7587
3
+ metadata.gz: 2e909e04e9f8d28d66830424a835382cbd8f1e19
4
+ data.tar.gz: 22837b6f669097bf247375947ffd8dc3c9a83c91
5
5
  SHA512:
6
- metadata.gz: e727bf39374da3542301522a1c37b043eba94af34f8c694e801934fe9f77a82da3677b693bf885087c8f88f975d067804f42c969c530ea5341bf683ce3b03e17
7
- data.tar.gz: 3062b9fa022c7c2399bc703c6fbd17230cb5be9532d93225a3aff0f235c41591e987efe1b67398e0fb6d0c15eef0079d3040c6a7b4b1841b5a5e0dca5f7a80ce
6
+ metadata.gz: be9d1aa084a9a31d440e60885e5db535eeb28d5c1ca1e1e1863d0cc4c1b811f56123c8f0beabf63622811cdee20b4774c686617b2e9bc2e3ed3d6070a333a8e6
7
+ data.tar.gz: c610292f6fae975fbd54d7741cc031eb8e04b0034e9020517b41d270025a5dabad6b2b832c079f579d4ce4eac4239cda089b6b81e727370dd1db7ed27d20acd6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ 0.1.4
2
+ -----
3
+ * Bugfix for queries containing "anytime"
4
+
1
5
  0.1.3
2
6
  -----
3
7
  * Bugfix for "cannot load such file -- nickel/version"
@@ -1011,7 +1011,7 @@ module Nickel
1011
1011
  end
1012
1012
 
1013
1013
  def found_all_day
1014
- @constructs << TimeConstruct.new(time: nil, comp_start: @pos, comp_end: @pos += 1, found_in: __method__)
1014
+ # @constructs << TimeConstruct.new(time: nil, comp_start: @pos, comp_end: @pos += 1, found_in: __method__)
1015
1015
  end
1016
1016
 
1017
1017
  def match_tomorrow
@@ -1,3 +1,3 @@
1
1
  module Nickel
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
@@ -968,12 +968,13 @@ describe Nickel do
968
968
  end
969
969
  end
970
970
 
971
- context "when the query is '6 days from tomorrow'", broken: true do
971
+ context "when the query is '6 days from tomorrow'", :broken do
972
972
  let(:query) { '6 days from tomorrow' }
973
973
  let(:run_date) { Time.local(2014, 2, 12) }
974
974
 
975
975
  describe '#occurrences' do
976
976
  it 'is 7 days from now' do
977
+ # returns only tomorrow, with the message '6 days'
977
978
  expect(n.occurrences).to match_array [
978
979
  Nickel::Occurrence.new(type: :single, start_date: Nickel::ZDate.new('20140218'))
979
980
  ]
@@ -1360,13 +1361,13 @@ describe Nickel do
1360
1361
  end
1361
1362
  end
1362
1363
 
1363
- context "when the query is 'every monday at 2pm and wednesday at 4pm'", broken: true do
1364
- # FIXME: this spec should have two occurrences
1364
+ context "when the query is 'every monday at 2pm and wednesday at 4pm'", :broken do
1365
1365
  let(:query) { 'every monday at 2pm and wednesday at 4pm' }
1366
1366
  let(:run_date) { Time.local(2008, 9, 18) }
1367
1367
 
1368
1368
  describe '#occurrences' do
1369
1369
  it 'is every Monday at 2:00pm and every Wednesday at 4:00pm' do
1370
+ # returns only monday at 2pm
1370
1371
  expect(n.occurrences).to match_array [
1371
1372
  Nickel::Occurrence.new(type: :weekly, day_of_week: 0, interval: 1, start_date: Nickel::ZDate.new('20080922'), start_time: Nickel::ZTime.new('14')),
1372
1373
  Nickel::Occurrence.new(type: :weekly, day_of_week: 2, interval: 1, start_date: Nickel::ZDate.new('20080924'), start_time: Nickel::ZTime.new('16'))
@@ -1933,5 +1934,314 @@ describe Nickel do
1933
1934
  end
1934
1935
  end
1935
1936
  end
1937
+
1938
+ context "when the query is 'meeting with Jimmy at 7am'", :broken do
1939
+ let(:query) { 'meeting with Jimmy at 7am' }
1940
+ let(:run_date) { Time.local(2014, 4, 18) }
1941
+
1942
+ describe '#message' do
1943
+ it "is 'meeting with Jimmy'" do
1944
+ expect(n.message).to eq 'meeting with Jimmy'
1945
+ end
1946
+ end
1947
+
1948
+ describe '#occurrences' do
1949
+ it 'is 7am today' do
1950
+ # returns no occurrences at all
1951
+ expect(n.occurrences).to match_array [
1952
+ Nickel::Occurrence.new(type: :single, start_date: Nickel::ZDate.new('20140418'), start_time: Nickel::ZTime.new('7'))
1953
+ ]
1954
+ end
1955
+ end
1956
+ end
1957
+
1958
+ context "when the query is 'meeting at 8 o'clock'", :broken do
1959
+ let(:query) { "meeting at 8 o'clock" }
1960
+ let(:run_date) { Time.local(2014, 4, 18, 12, 0) }
1961
+
1962
+ describe '#message' do
1963
+ it "is 'meeting'" do
1964
+ expect(n.message).to eq 'meeting'
1965
+ end
1966
+ end
1967
+
1968
+ describe '#occurrences' do
1969
+ it "is the next 8 o'clock" do
1970
+ # returns no occurrences
1971
+ expect(n.occurrences).to match_array [
1972
+ Nickel::Occurrence.new(type: :single, start_date: Nickel::ZDate.new('20140418'), start_time: Nickel::ZTime.new('20'))
1973
+ ]
1974
+ end
1975
+ end
1976
+ end
1977
+
1978
+ context "when the query is 'let's do it today'", :broken do
1979
+ let(:query) { "let's do it today" }
1980
+ let(:run_date) { Time.local(2014, 4, 18) }
1981
+
1982
+ describe '#message' do
1983
+ it "is 'let's do it'" do
1984
+ # returns "lets do it" (no apostrophe)
1985
+ expect(n.message).to eq "let's do it"
1986
+ end
1987
+ end
1988
+
1989
+ describe '#occurrences' do
1990
+ it 'is today' do
1991
+ expect(n.occurrences).to match_array [
1992
+ Nickel::Occurrence.new(type: :single, start_date: Nickel::ZDate.new('20140418'))
1993
+ ]
1994
+ end
1995
+ end
1996
+ end
1997
+
1998
+ context "when the query is 'let us do it today'" do
1999
+ let(:query) { 'let us do it today' }
2000
+ let(:run_date) { Time.local(2014, 4, 18) }
2001
+
2002
+ describe '#message' do
2003
+ it "is 'let us do it'" do
2004
+ expect(n.message).to eq "let us do it"
2005
+ end
2006
+ end
2007
+
2008
+ describe '#occurrences' do
2009
+ it 'is today' do
2010
+ expect(n.occurrences).to match_array [
2011
+ Nickel::Occurrence.new(type: :single, start_date: Nickel::ZDate.new('20140418'))
2012
+ ]
2013
+ end
2014
+ end
2015
+ end
2016
+
2017
+ context "when the query is 'let us do it today!'", :broken do
2018
+ let(:query) { 'let us do it today!' }
2019
+ let(:run_date) { Time.local(2014, 4, 18) }
2020
+
2021
+ describe '#message' do
2022
+ it "is 'let us do it!'" do
2023
+ # returns "let us do it today!"
2024
+ expect(n.message).to eq 'let us do it!'
2025
+ end
2026
+ end
2027
+
2028
+ describe '#occurrences' do
2029
+ it 'is today' do
2030
+ # returns no occurrences
2031
+ expect(n.occurrences).to match_array [
2032
+ Nickel::Occurrence.new(type: :single, start_date: Nickel::ZDate.new('20140418'))
2033
+ ]
2034
+ end
2035
+ end
2036
+ end
2037
+
2038
+ context "when the query is 'tomorrow morning'", :broken do
2039
+ let(:query) { 'tomorrow morning' }
2040
+ let(:run_date) { Time.local(2014, 4, 18) }
2041
+
2042
+ describe '#occurrences' do
2043
+ it 'is 3am to 12pm tomorrow' do
2044
+ # returns tomorrow
2045
+ expect(n.occurrences).to match_array [
2046
+ Nickel::Occurrence.new(type: :single, start_date: Nickel::ZDate.new('20140419'), start_time: Nickel::ZTime.new('3'), end_time: Nickel::ZTime.new('12'))
2047
+ ]
2048
+ end
2049
+ end
2050
+ end
2051
+
2052
+ context "when the query is 'tomorrow afternoon'", :broken do
2053
+ let(:query) { 'tomorrow afternoon' }
2054
+ let(:run_date) { Time.local(2014, 4, 18) }
2055
+
2056
+ describe '#occurrences' do
2057
+ it 'is 12pm to 6pm tomorrow' do
2058
+ # returns tomorrow at 12pm
2059
+ expect(n.occurrences).to match_array [
2060
+ Nickel::Occurrence.new(type: :single, start_date: Nickel::ZDate.new('20140419'), start_time: Nickel::ZTime.new('12'), end_time: Nickel::ZTime.new('18'))
2061
+ ]
2062
+ end
2063
+ end
2064
+ end
2065
+
2066
+ context "when the query is 'tomorrow evening'", :broken do
2067
+ let(:query) { 'tomorrow evening' }
2068
+ let(:run_date) { Time.local(2014, 4, 18) }
2069
+
2070
+ describe '#occurrences' do
2071
+ it 'is 6pm to 9pm tomorrow' do
2072
+ # returns tomorrow
2073
+ expect(n.occurrences).to match_array [
2074
+ Nickel::Occurrence.new(type: :single, start_date: Nickel::ZDate.new('20140419'), start_time: Nickel::ZTime.new('18'), end_time: Nickel::ZTime.new('21'))
2075
+ ]
2076
+ end
2077
+ end
2078
+ end
2079
+
2080
+ context "when the query is 'tomorrow night'", :broken do
2081
+ let(:query) { 'tomorrow night' }
2082
+ let(:run_date) { Time.local(2014, 4, 18) }
2083
+
2084
+ describe '#occurrences' do
2085
+ it 'is 9pm tomorrow to 3am the day after tomorrow' do
2086
+ # returns tomorrow
2087
+ expect(n.occurrences).to match_array [
2088
+ Nickel::Occurrence.new(type: :single, start_date: Nickel::ZDate.new('20140419'), start_time: Nickel::ZTime.new('9'), end_date: Nickel::ZDate.new('20140420'), end_time: Nickel::ZTime.new('3'))
2089
+ ]
2090
+ end
2091
+ end
2092
+ end
2093
+
2094
+ context "when the query is 'let us go dancing at 3 in the morning'", :broken do
2095
+ let(:query) { 'let us go dancing at 3 in the morning' }
2096
+ let(:run_date) { Time.local(2014, 4, 18) }
2097
+
2098
+ describe '#message' do
2099
+ it "is 'let us go dancing'" do
2100
+ expect(n.message).to eq 'let us go dancing'
2101
+ end
2102
+ end
2103
+
2104
+ describe '#occurrences' do
2105
+ it 'is 3am' do
2106
+ # returns no occurrences
2107
+ expect(n.occurrences).to match_array [
2108
+ Nickel::Occurrence.new(type: :single, start_date: Nickel::ZDate.new('20140419'), start_time: Nickel::ZTime.new('3'))
2109
+ ]
2110
+ end
2111
+ end
2112
+ end
2113
+
2114
+ context "when the query is 'let us go dancing on 12/07/2014'" do
2115
+ let(:query) { 'let us go dancing on 12/07/2014' }
2116
+
2117
+ describe '#message' do
2118
+ it "is 'let us go dancing'" do
2119
+ expect(n.message).to eq 'let us go dancing'
2120
+
2121
+ end
2122
+ end
2123
+
2124
+ describe '#occurrences' do
2125
+ it 'is 7th of December 2014' do
2126
+ expect(n.occurrences).to match_array [
2127
+ Nickel::Occurrence.new(type: :single, start_date: Nickel::ZDate.new('20141207'))
2128
+ ]
2129
+ end
2130
+ end
2131
+ end
2132
+
2133
+ context "when the query is 'every sunday until 2015", :broken do
2134
+ let(:query) { 'every sunday until 2015' }
2135
+ let(:run_date) { Time.local(2014, 4, 18) }
2136
+
2137
+ describe '#occurrences' do
2138
+ it 'every sunday until the last sunday of 2014' do
2139
+ expect(n.occurrences).to match_array [
2140
+ Nickel::Occurrence.new(type: :weekly, interval: 1, day_of_week: 6, start_date: Nickel::ZDate.new('20140420'), end_date: Nickel::ZDate.new('20141228'))
2141
+ ]
2142
+ end
2143
+ end
2144
+ end
2145
+
2146
+ context "when the query is 'give me two cents in 5 minutes'", :broken do
2147
+ let(:query) { 'give me two cents in 5 minutes' }
2148
+ let(:run_date) { Time.local(2014, 4, 18, 12, 0) }
2149
+
2150
+ describe '#message' do
2151
+ it "is 'give me two cents'" do
2152
+ # returns give me cents
2153
+ expect(n.message).to eq 'give me two cents'
2154
+ end
2155
+ end
2156
+
2157
+ describe '#occurrences' do
2158
+ it 'is 12:05pm' do
2159
+ # returns 2am
2160
+ expect(n.occurrences).to match_array [
2161
+ Nickel::Occurrence.new(type: :single, start_date: Nickel::ZDate.new('20140418'), start_time: Nickel::ZTime.new('1205'))
2162
+ ]
2163
+ end
2164
+ end
2165
+ end
2166
+
2167
+ context "when the query is 'give me two cents in 3 days'", :broken do
2168
+ let(:query) { 'give me two cents in 3 days' }
2169
+ let(:run_date) { Time.local(2014, 4, 18) }
2170
+
2171
+ describe '#message' do
2172
+ it "is 'give me two cents'" do
2173
+ # returns give me cents
2174
+ expect(n.message).to eq 'give me two cents'
2175
+ end
2176
+ end
2177
+
2178
+ describe '#occurrences' do
2179
+ it 'is two days from now' do
2180
+ # returns 2am 3 days from now
2181
+ expect(n.occurrences).to match_array [
2182
+ Nickel::Occurrence.new(type: :single, start_date: Nickel::ZDate.new('20140421'))
2183
+ ]
2184
+ end
2185
+ end
2186
+ end
2187
+
2188
+ context "when the query is 'tomorrow anytime'" do
2189
+ let(:query) { 'tomorrow anytime' }
2190
+ let(:run_date) { Time.local(2014, 4, 18) }
2191
+
2192
+ describe '#occurrences' do
2193
+ it 'is tomorrow' do
2194
+ expect(n.occurrences).to match_array [
2195
+ Nickel::Occurrence.new(type: :single, start_date: Nickel::ZDate.new('20140419'))
2196
+ ]
2197
+ end
2198
+ end
2199
+ end
2200
+
2201
+ context "when the query is 'all day tomorrow'" do
2202
+ let(:query) { 'all day tomorrow' }
2203
+ let(:run_date) { Time.local(2014, 4, 18) }
2204
+
2205
+ describe '#occurrences' do
2206
+ it 'is tomorrow' do
2207
+ expect(n.occurrences).to match_array [
2208
+ Nickel::Occurrence.new(type: :single, start_date: Nickel::ZDate.new('20140419'))
2209
+ ]
2210
+ end
2211
+ end
2212
+ end
2213
+
2214
+ context "when the query is 'job search apply at virgin intergalactic'" do
2215
+ let(:query) { 'job search apply at virgin intergalactic' }
2216
+
2217
+ describe '#message' do
2218
+ it "is 'job search apply at virgin intergalactic'" do
2219
+ expect(n.message).to eq 'job search apply at virgin intergalactic'
2220
+ end
2221
+ end
2222
+
2223
+ describe '#occurrences' do
2224
+ it 'is an empty array' do
2225
+ expect(n.occurrences).to be_empty
2226
+ end
2227
+ end
2228
+ end
2229
+
2230
+ context "when the query is 'job search - apply at virgin intergalactic'", :broken do
2231
+ let(:query) { 'job search - apply at virgin intergalactic' }
2232
+
2233
+ describe '#message' do
2234
+ it "is 'job search - apply at virgin intergalactic'" do
2235
+ expect(n.message).to eq 'job search - apply at virgin intergalactic'
2236
+ end
2237
+ end
2238
+
2239
+ describe '#occurrences' do
2240
+ it 'is an empty array' do
2241
+ # returns every day from today
2242
+ expect(n.occurrences).to be_empty
2243
+ end
2244
+ end
2245
+ end
1936
2246
  end
1937
2247
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nickel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lou Zell