timely 0.6.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6fd5bf30099265da88c4957079fd58a4db290fac8cd4ad239ddb395be546d5d3
4
- data.tar.gz: d263dca100292aae36f54b22cc2f3b1eebc1c1df0274fc3ef730ce991fc94c4a
3
+ metadata.gz: 6aa86a2d85c75b320398194d92abfa5ddb0cf5eb15e26312d619c07fd8d89783
4
+ data.tar.gz: 6062dae4792ec644a1b7c9de0cfbcc14dba8b560e3b79f117f9e95f6bd311608
5
5
  SHA512:
6
- metadata.gz: 784aede0c406afe8e0213f275150ee3bba930969c28acf9ac2e992a96ce42c7f30e042a6e0ae9779dc17f86e6a7744c4b0a07bf72e1d326d6e6176b3ac4b28c4
7
- data.tar.gz: a780a85c02adcf074c53376c7995739d609329256b76c370966bedaccf953e0e3cb7607cb0d381873a8a4585b48505c8d2d04f68bebdc94f0b49c947bab84d28
6
+ metadata.gz: 65880f47a10857ebaa6a5f6cb7a1cbf2bd9436d125a454ddff9f28a2144ec2eb9a917e26458efacd4865e5ef984d870ba2da3b0114d2f3e5d18f036218176965
7
+ data.tar.gz: ccfa4cf94063269922a0bf08c4ba3be6e67ee74d8be3f94857c1a75a506e109f25fef42d794e6e301d7d5dd06a519fd817f5fb169bfa18c2a66b49b73b53339e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.10.0
4
+
5
+ * [PLAT-183] Publish coveralls with github actions add ruby 3.1 to test matrix
6
+
7
+ ## 0.9.0
8
+
9
+ * [TT-8614] Update to build with github actions / ruby 3.0 / rails 6.1
10
+
11
+ ## 0.8.0
12
+
13
+ * [TT-6441] Turns out we don't actually need time difference in QT
14
+ * [TT-6661] Fix issue when detecting intersecting date groups
15
+
16
+ ## 0.7.0
17
+
18
+ * [TT-6441] Due to TimeDifference being unmaintained bring it into the timely library
19
+
3
20
  ## 0.6.0
4
21
 
5
22
  * [TT-6402] Require date group weekdays bit field to be not null/nil
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  # Timely
2
2
 
3
- [![Build Status](https://travis-ci.org/sealink/timely.png?branch=master)](https://travis-ci.org/sealink/timely)
3
+ [![Build Status](https://github.com/sealink/timely/workflows/Build%20and%20Test/badge.svg?branch=master)](https://github.com/sealink/timely/actions)
4
4
  [![Coverage Status](https://coveralls.io/repos/sealink/timely/badge.png)](https://coveralls.io/r/sealink/timely)
5
- [![Dependency Status](https://gemnasium.com/sealink/timely.png?travis)](https://gemnasium.com/sealink/timely)
6
5
  [![Code Climate](https://codeclimate.com/github/sealink/timely.png)](https://codeclimate.com/github/sealink/timely)
7
6
 
8
7
  # DESCRIPTION
@@ -59,3 +58,15 @@ some_date.at_time(some_time) # => Sat May 03 13:40:22 -0500 2008
59
58
  some_time.on(some_date) # => Sat May 03 13:40:22 -0500 2008
60
59
  some_date.at(some_time) # => Sat May 03 13:40:22 -0500 2008
61
60
  ```
61
+
62
+ # Release
63
+
64
+ To publish a new version of this gem the following steps must be taken.
65
+
66
+ * Update the version in the following files
67
+ ```
68
+ CHANGELOG.md
69
+ lib/timely/version.rb
70
+ ````
71
+ * Create a tag using the format v0.1.0
72
+ * Follow build progress in GitHub actions
@@ -18,9 +18,7 @@ module Timely
18
18
  scope :within_range, lambda { |date_range|
19
19
  # IMPORTANT: Required for correctness in case of string param.
20
20
  dates = Array(date_range)
21
- scope = covering_date(dates.first)
22
- scope = scope.or(covering_date(dates.last)) if dates.first != dates.last
23
- scope
21
+ where(arel_table[:start_date].lteq(dates.last)).where(arel_table[:end_date].gteq(dates.first))
24
22
  }
25
23
 
26
24
  scope :for_any_weekdays, lambda { |weekdays_int|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Timely
4
- VERSION = '0.6.0'
4
+ VERSION = '0.10.0'
5
5
  end
data/timely.gemspec CHANGED
@@ -15,24 +15,22 @@ Gem::Specification.new do |spec|
15
15
 
16
16
  spec.license = 'MIT'
17
17
 
18
- spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
19
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.files = Dir["CHANGELOG.md", "README.md", "timely.gemspec", "lib/**/*"]
19
+ spec.executables = []
21
20
  spec.require_paths = ['lib']
21
+ spec.required_ruby_version = '>= 2.7'
22
22
 
23
- spec.add_development_dependency 'actionpack'
24
- spec.add_development_dependency 'activerecord'
25
- spec.add_development_dependency 'activesupport'
26
- spec.add_development_dependency 'bundler', '~> 2.0.1'
23
+ spec.add_development_dependency 'activerecord', '>=6', '<8'
24
+ spec.add_development_dependency 'activesupport', '>=6', '<8'
25
+ spec.add_development_dependency 'bundler'
27
26
  spec.add_development_dependency 'coverage-kit'
28
- spec.add_development_dependency 'coveralls'
29
27
  spec.add_development_dependency 'rake'
30
28
  spec.add_development_dependency 'rspec'
31
29
  spec.add_development_dependency 'rspec-its'
30
+ spec.add_development_dependency 'database_cleaner'
32
31
  spec.add_development_dependency 'rubocop'
33
32
  spec.add_development_dependency 'rubocop-rails'
34
- spec.add_development_dependency 'simplecov-rcov'
35
33
  spec.add_development_dependency 'sqlite3'
36
34
  spec.add_development_dependency 'timecop'
37
- spec.add_development_dependency 'travis'
35
+ spec.add_development_dependency 'pry'
38
36
  end
metadata CHANGED
@@ -1,73 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timely
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Noack
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-27 00:00:00.000000000 Z
11
+ date: 2022-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: actionpack
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: activerecord
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
17
  - - ">="
32
18
  - !ruby/object:Gem::Version
33
- version: '0'
19
+ version: '6'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '8'
34
23
  type: :development
35
24
  prerelease: false
36
25
  version_requirements: !ruby/object:Gem::Requirement
37
26
  requirements:
38
27
  - - ">="
39
28
  - !ruby/object:Gem::Version
40
- version: '0'
29
+ version: '6'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '8'
41
33
  - !ruby/object:Gem::Dependency
42
34
  name: activesupport
43
35
  requirement: !ruby/object:Gem::Requirement
44
36
  requirements:
45
37
  - - ">="
46
38
  - !ruby/object:Gem::Version
47
- version: '0'
39
+ version: '6'
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '8'
48
43
  type: :development
49
44
  prerelease: false
50
45
  version_requirements: !ruby/object:Gem::Requirement
51
46
  requirements:
52
47
  - - ">="
53
48
  - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: bundler
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: 2.0.1
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
49
+ version: '6'
50
+ - - "<"
67
51
  - !ruby/object:Gem::Version
68
- version: 2.0.1
52
+ version: '8'
69
53
  - !ruby/object:Gem::Dependency
70
- name: coverage-kit
54
+ name: bundler
71
55
  requirement: !ruby/object:Gem::Requirement
72
56
  requirements:
73
57
  - - ">="
@@ -81,7 +65,7 @@ dependencies:
81
65
  - !ruby/object:Gem::Version
82
66
  version: '0'
83
67
  - !ruby/object:Gem::Dependency
84
- name: coveralls
68
+ name: coverage-kit
85
69
  requirement: !ruby/object:Gem::Requirement
86
70
  requirements:
87
71
  - - ">="
@@ -137,7 +121,7 @@ dependencies:
137
121
  - !ruby/object:Gem::Version
138
122
  version: '0'
139
123
  - !ruby/object:Gem::Dependency
140
- name: rubocop
124
+ name: database_cleaner
141
125
  requirement: !ruby/object:Gem::Requirement
142
126
  requirements:
143
127
  - - ">="
@@ -151,7 +135,7 @@ dependencies:
151
135
  - !ruby/object:Gem::Version
152
136
  version: '0'
153
137
  - !ruby/object:Gem::Dependency
154
- name: rubocop-rails
138
+ name: rubocop
155
139
  requirement: !ruby/object:Gem::Requirement
156
140
  requirements:
157
141
  - - ">="
@@ -165,7 +149,7 @@ dependencies:
165
149
  - !ruby/object:Gem::Version
166
150
  version: '0'
167
151
  - !ruby/object:Gem::Dependency
168
- name: simplecov-rcov
152
+ name: rubocop-rails
169
153
  requirement: !ruby/object:Gem::Requirement
170
154
  requirements:
171
155
  - - ">="
@@ -207,7 +191,7 @@ dependencies:
207
191
  - !ruby/object:Gem::Version
208
192
  version: '0'
209
193
  - !ruby/object:Gem::Dependency
210
- name: travis
194
+ name: pry
211
195
  requirement: !ruby/object:Gem::Requirement
212
196
  requirements:
213
197
  - - ">="
@@ -227,18 +211,8 @@ executables: []
227
211
  extensions: []
228
212
  extra_rdoc_files: []
229
213
  files:
230
- - ".gitignore"
231
- - ".rspec"
232
- - ".rubocop.yml"
233
- - ".ruby-version"
234
- - ".travis.yml"
235
214
  - CHANGELOG.md
236
- - Gemfile
237
- - LICENSE
238
215
  - README.md
239
- - Rakefile
240
- - gemfiles/rails5.gemfile
241
- - gemfiles/rails6.gemfile
242
216
  - lib/timely.rb
243
217
  - lib/timely/date.rb
244
218
  - lib/timely/date_chooser.rb
@@ -266,26 +240,6 @@ files:
266
240
  - lib/timely/trackable_date_set.rb
267
241
  - lib/timely/version.rb
268
242
  - lib/timely/week_days.rb
269
- - rails/init.rb
270
- - spec/calendar_tag_spec.rb
271
- - spec/date_chooser_spec.rb
272
- - spec/date_group_spec.rb
273
- - spec/date_range_spec.rb
274
- - spec/date_spec.rb
275
- - spec/extensions_spec.rb
276
- - spec/rails/date_spec.rb
277
- - spec/rails/date_time_spec.rb
278
- - spec/rails/period_spec.rb
279
- - spec/rails/time_spec.rb
280
- - spec/schema.rb
281
- - spec/season_spec.rb
282
- - spec/spec_helper.rb
283
- - spec/support/coverage_loader.rb
284
- - spec/temporal_patterns_spec.rb
285
- - spec/time_since_spec.rb
286
- - spec/time_spec.rb
287
- - spec/trackable_date_set_spec.rb
288
- - spec/week_days_spec.rb
289
243
  - timely.gemspec
290
244
  homepage: http://github.com/sealink/timely
291
245
  licenses:
@@ -299,34 +253,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
299
253
  requirements:
300
254
  - - ">="
301
255
  - !ruby/object:Gem::Version
302
- version: '0'
256
+ version: '2.7'
303
257
  required_rubygems_version: !ruby/object:Gem::Requirement
304
258
  requirements:
305
259
  - - ">="
306
260
  - !ruby/object:Gem::Version
307
261
  version: '0'
308
262
  requirements: []
309
- rubygems_version: 3.0.3
263
+ rubygems_version: 3.3.3
310
264
  signing_key:
311
265
  specification_version: 4
312
266
  summary: Set of time, date, weekday related methods.
313
- test_files:
314
- - spec/calendar_tag_spec.rb
315
- - spec/date_chooser_spec.rb
316
- - spec/date_group_spec.rb
317
- - spec/date_range_spec.rb
318
- - spec/date_spec.rb
319
- - spec/extensions_spec.rb
320
- - spec/rails/date_spec.rb
321
- - spec/rails/date_time_spec.rb
322
- - spec/rails/period_spec.rb
323
- - spec/rails/time_spec.rb
324
- - spec/schema.rb
325
- - spec/season_spec.rb
326
- - spec/spec_helper.rb
327
- - spec/support/coverage_loader.rb
328
- - spec/temporal_patterns_spec.rb
329
- - spec/time_since_spec.rb
330
- - spec/time_spec.rb
331
- - spec/trackable_date_set_spec.rb
332
- - spec/week_days_spec.rb
267
+ test_files: []
data/.gitignore DELETED
@@ -1,6 +0,0 @@
1
- pkg
2
- coverage
3
- Gemfile.lock
4
- tmp
5
- .bundle
6
- vendor
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --color
2
- --format progress
data/.rubocop.yml DELETED
@@ -1,28 +0,0 @@
1
- AllCops:
2
- TargetRubyVersion: 2.6
3
- Exclude:
4
- - lib/timely/temporal_patterns/*.rb
5
-
6
- Metrics/LineLength:
7
- Max: 200
8
-
9
- Style/Documentation:
10
- Enabled: false
11
-
12
- Style/FrozenStringLiteralComment:
13
- Enabled: true
14
-
15
- Metrics/BlockLength:
16
- Enabled: false
17
-
18
- Metrics/MethodLength:
19
- Enabled: false
20
-
21
- Metrics/AbcSize:
22
- Enabled: false
23
-
24
- Metrics/CyclomaticComplexity:
25
- Enabled: false
26
-
27
- Metrics/PerceivedComplexity:
28
- Enabled: false
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 2.6.3
data/.travis.yml DELETED
@@ -1,16 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.6
4
- matrix:
5
- fast_finish: true
6
- before_install:
7
- - gem install bundler
8
- script: bundle exec rake spec
9
- gemfile:
10
- - gemfiles/rails5.gemfile
11
- - gemfiles/rails6.gemfile
12
- notifications:
13
- email:
14
- - support@travellink.com.au
15
- sudo: false
16
- cache: bundler
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
- gemspec
data/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- The MIT License
2
-
3
- Copyright (c) Tom Preston-Werner
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
data/Rakefile DELETED
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
4
-
5
- desc 'Default: run specs.'
6
- task default: :spec
7
-
8
- require 'rspec/core/rake_task'
9
-
10
- desc 'Run specs'
11
- RSpec::Core::RakeTask.new do |t|
12
- t.pattern = './spec/**/*_spec.rb' # don't need this, it's default.
13
- # Put spec opts in a file named .rspec in root
14
- end
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
- gemspec path: '../'
5
-
6
- group :development, :test do
7
- gem 'activerecord', '~> 5.2'
8
- end
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
- gemspec path: '../'
5
-
6
- group :development, :test do
7
- gem 'activerecord', '~> 6.0.0.rc1'
8
- end
data/rails/init.rb DELETED
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'timely/rails'
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- class ActionViewTest
6
- include Timely::ActionViewHelpers::FormTagHelper
7
- end
8
-
9
- describe Timely::ActionViewHelpers do
10
- subject { ActionViewTest.new }
11
- let(:string) { double(:string) }
12
- let(:date) { Date.new(2000, 12, 25) }
13
- before do
14
- expect(date).to receive(:to_s).with(:calendar).and_return('25-12-2000')
15
- expect(Timely).to receive(:current_date).and_return(date)
16
- end
17
-
18
- it 'should generate calendar tags' do
19
- expect(string).to receive(:html_safe)
20
- expect(subject).to receive(:tag).with(:input,
21
- id: 'test',
22
- class: 'datepicker',
23
- size: 10,
24
- maxlength: 10,
25
- name: 'test',
26
- type: 'text',
27
- value: '25-12-2000').and_return(string)
28
- subject.calendar_tag :test
29
- end
30
- end
@@ -1,115 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe Timely::DateChooser do
6
- before(:all) do
7
- @from = '01-01-2011'.to_date
8
- @to = '01-03-2011'.to_date
9
- end
10
-
11
- # Validation
12
- it 'rejects blank FROM dates' do
13
- expect { Timely::DateChooser.new(from: '') }.to raise_error(
14
- Timely::DateChooserException, 'A Start Date is required'
15
- )
16
- end
17
-
18
- it 'rejects TO dates later than FROM dates' do
19
- expect do
20
- Timely::DateChooser.new(
21
- multiple_dates: true, from: @from + 10, to: @from
22
- )
23
- end .to raise_error(Timely::DateChooserException, 'Start Date is after End Date')
24
- end
25
-
26
- # Operation
27
- it 'returns today if client only wants single date' do
28
- expect(Timely::DateChooser.new(
29
- multiple_dates: false, from: @from
30
- ).choose_dates).to eq [@from]
31
- end
32
-
33
- # Test specific date of month
34
- it 'returns from and to as same (one) day in the case that only from date is given' do
35
- expect(Timely::DateChooser.new(
36
- multiple_dates: true, from: @from, to: ''
37
- ).choose_dates).to eq [@from]
38
- end
39
-
40
- it 'returns all days between from and to days in the basic case' do
41
- expect(Timely::DateChooser.new(
42
- multiple_dates: true, from: @from, to: @to
43
- ).choose_dates).to eq((@from..@to).to_a)
44
- end
45
-
46
- it 'returns the recurring dates within the range if this option is picked' do
47
- expect(Timely::DateChooser.new(
48
- multiple_dates: true, select: 'days', dates: '1,11,3', from: @from, to: @to
49
- ).choose_dates).to eq %w[
50
- 1-01-2011 3-01-2011 11-01-2011 1-02-2011
51
- 3-02-2011 11-02-2011 1-03-2011
52
- ].map(&:to_date)
53
- end
54
-
55
- it 'returns the specific dates, within or outside of the range, if this option is picked' do
56
- expect(Timely::DateChooser.new(
57
- multiple_dates: true, select: 'specific_days', specific_dates: '11-01-2011, 18-02-2011, 22-06-2011', from: @from, to: @to
58
- ).choose_dates).to eq %w[
59
- 11-01-2011 18-02-2011 22-06-2011
60
- ].map(&:to_date)
61
- end
62
-
63
- # Test days of week, every X weeks
64
- it 'returns every sunday correctly' do
65
- expect(Timely::DateChooser.new(
66
- multiple_dates: true, select: 'weekdays', from: @from, to: @to,
67
- interval: { level: '1', unit: 'week' }, weekdays: { sun: true }
68
- ).choose_dates).to eq %w[
69
- 2-01-2011 9-01-2011 16-01-2011 23-01-2011 30-01-2011
70
- 06-02-2011 13-02-2011 20-02-2011 27-02-2011
71
- ].map(&:to_date)
72
- end
73
-
74
- it 'returns every thursday and sunday correctly' do
75
- expect(Timely::DateChooser.new(
76
- multiple_dates: true, select: 'weekdays',
77
- interval: { level: '1', unit: 'week' },
78
- weekdays: { sun: true, thu: true }, from: @from, to: @to
79
- ).choose_dates).to eq %w[
80
- 2-01-2011 6-01-2011 9-01-2011 13-01-2011 16-01-2011
81
- 20-01-2011 23-01-2011 27-01-2011 30-01-2011 3-02-2011
82
- 06-02-2011 10-02-2011 13-02-2011 17-02-2011 20-02-2011
83
- 24-02-2011 27-02-2011
84
- ].map(&:to_date)
85
- end
86
-
87
- it 'returns every 2nd thursday and sunday correctly' do
88
- expect(Timely::DateChooser.new(
89
- multiple_dates: true, select: 'weekdays',
90
- interval: { level: '2', unit: 'week' },
91
- weekdays: { sun: '1', thu: '1' }, from: @from, to: @to
92
- ).choose_dates).to eq %w[
93
- 2-01-2011 6-01-2011 16-01-2011 20-01-2011 30-01-2011
94
- 3-02-2011 13-02-2011 17-02-2011 27-02-2011
95
- ].map(&:to_date)
96
- end
97
-
98
- # Test correct results for every Nth week of month
99
- it 'returns every 1st Tuesday' do
100
- expect(Timely::DateChooser.new(
101
- multiple_dates: true, select: 'weekdays', from: @from, to: @to,
102
- interval: { level: '1', unit: 'week_of_month' }, weekdays: { tue: true }
103
- ).choose_dates).to eq %w[4-01-2011 1-02-2011 1-03-2011].map(&:to_date)
104
- end
105
-
106
- it 'returns every 3st Monday and Friday' do
107
- expect(Timely::DateChooser.new(
108
- multiple_dates: true, select: 'weekdays',
109
- interval: { level: '3', unit: 'week_of_month' },
110
- weekdays: { mon: true, fri: true }, from: @from, to: @to
111
- ).choose_dates).to eq %w[
112
- 17-01-2011 21-01-2011 18-02-2011 21-02-2011
113
- ].map(&:to_date)
114
- end
115
- end