by_star 2.2.0 → 4.0.0

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.
Files changed (66) hide show
  1. checksums.yaml +5 -13
  2. data/.github/workflows/mysql.yml +92 -0
  3. data/.github/workflows/postgresql.yml +99 -0
  4. data/.gitignore +6 -5
  5. data/.travis.yml +92 -35
  6. data/CHANGELOG.md +59 -29
  7. data/Gemfile +18 -25
  8. data/MIT-LICENSE +20 -20
  9. data/README.md +616 -523
  10. data/Rakefile +18 -18
  11. data/UPGRADING +4 -12
  12. data/by_star.gemspec +34 -32
  13. data/cleaner.rb +24 -24
  14. data/lib/by_star/base.rb +69 -68
  15. data/lib/by_star/between.rb +185 -120
  16. data/lib/by_star/directional.rb +35 -21
  17. data/lib/by_star/kernel/date.rb +41 -0
  18. data/lib/by_star/kernel/in_time_zone.rb +20 -0
  19. data/lib/by_star/{kernel.rb → kernel/time.rb} +41 -41
  20. data/lib/by_star/normalization.rb +156 -118
  21. data/lib/by_star/orm/active_record/by_star.rb +75 -59
  22. data/lib/by_star/orm/mongoid/by_star.rb +90 -63
  23. data/lib/by_star/orm/mongoid/reorder.rb +23 -0
  24. data/lib/by_star/version.rb +3 -3
  25. data/lib/by_star.rb +18 -15
  26. data/spec/database.yml +15 -15
  27. data/spec/fixtures/active_record/models.rb +12 -10
  28. data/spec/fixtures/active_record/schema.rb +19 -19
  29. data/spec/fixtures/mongoid/models.rb +31 -29
  30. data/spec/fixtures/shared/seeds.rb +36 -26
  31. data/spec/gemfiles/Gemfile.rails +5 -0
  32. data/spec/gemfiles/Gemfile.rails32 +7 -0
  33. data/spec/gemfiles/Gemfile.rails40 +7 -0
  34. data/spec/gemfiles/Gemfile.rails41 +7 -0
  35. data/spec/gemfiles/Gemfile.rails42 +7 -0
  36. data/spec/gemfiles/Gemfile.rails50 +7 -0
  37. data/spec/gemfiles/Gemfile.rails51 +7 -0
  38. data/spec/gemfiles/Gemfile.rails52 +7 -0
  39. data/spec/gemfiles/Gemfile.rails60 +7 -0
  40. data/spec/gemfiles/Gemfile.rails61 +7 -0
  41. data/spec/integration/active_record/active_record_spec.rb +41 -53
  42. data/spec/integration/mongoid/mongoid_spec.rb +39 -46
  43. data/spec/integration/shared/at_time.rb +53 -0
  44. data/spec/integration/shared/between_dates.rb +99 -0
  45. data/spec/integration/shared/between_times.rb +99 -0
  46. data/spec/integration/shared/by_calendar_month.rb +55 -55
  47. data/spec/integration/shared/by_cweek.rb +54 -0
  48. data/spec/integration/shared/by_day.rb +120 -108
  49. data/spec/integration/shared/by_direction.rb +126 -114
  50. data/spec/integration/shared/by_fortnight.rb +48 -48
  51. data/spec/integration/shared/by_month.rb +50 -50
  52. data/spec/integration/shared/by_quarter.rb +49 -49
  53. data/spec/integration/shared/by_week.rb +54 -54
  54. data/spec/integration/shared/by_weekend.rb +49 -49
  55. data/spec/integration/shared/by_year.rb +48 -48
  56. data/spec/integration/shared/index_scope_parameter.rb +111 -0
  57. data/spec/integration/shared/offset_parameter.rb +32 -31
  58. data/spec/integration/shared/order_parameter.rb +36 -0
  59. data/spec/integration/shared/relative.rb +174 -174
  60. data/spec/spec_helper.rb +33 -29
  61. data/spec/unit/kernel_date_spec.rb +113 -0
  62. data/spec/unit/kernel_time_spec.rb +57 -57
  63. data/spec/unit/normalization_spec.rb +384 -255
  64. data/tmp/.gitignore +1 -1
  65. metadata +82 -68
  66. data/spec/integration/shared/scope_parameter.rb +0 -42
@@ -1,31 +1,32 @@
1
- require 'spec_helper'
2
-
3
- shared_examples_for 'offset parameter' do
4
-
5
- describe 'offset' do
6
- it 'should memoize the offset variable' do
7
- Event.instance_variable_get(:@by_star_offset).should eq 3.hours
8
- Post.instance_variable_get(:@by_star_offset).should be_nil
9
- end
10
-
11
- context 'between_times with default offset' do
12
- subject { Event.between_times(Time.parse('2014-01-01'), Time.parse('2014-01-10')) }
13
- its(:count) { should eq 7 }
14
- end
15
-
16
- context 'between_times with offset override' do
17
- subject { Event.between_times(Time.parse('2014-01-01'), Time.parse('2014-01-10'), offset: 16.hours) }
18
- its(:count) { should eq 7 }
19
- end
20
-
21
- context 'by_day with default offset' do
22
- subject { Event.by_day(Time.parse('2014-01-01')) }
23
- its(:count) { should eq 5 }
24
- end
25
-
26
- context 'by_day with offset override' do
27
- subject { Event.by_day(Time.parse('2014-12-26'), field: :start_time, offset: 5.hours) }
28
- its(:count) { should eq 0 }
29
- end
30
- end
31
- end
1
+ require 'spec_helper'
2
+
3
+ shared_examples_for 'offset parameter' do
4
+
5
+ describe ':offset' do
6
+
7
+ it 'should memoize the offset variable' do
8
+ expect(Event.instance_variable_get(:@by_star_offset)).to eq 3.hours
9
+ expect(Post.instance_variable_get(:@by_star_offset)).to be_nil
10
+ end
11
+
12
+ context 'between_times with default offset' do
13
+ subject { Event.between_times(Time.zone.parse('2014-01-01'), Time.zone.parse('2014-01-10')) }
14
+ it { expect(subject.count).to eql(7) }
15
+ end
16
+
17
+ context 'between_times with offset override' do
18
+ subject { Event.between_times(Time.zone.parse('2014-01-01')..Time.zone.parse('2014-01-10'), offset: 16.hours) }
19
+ it { expect(subject.count).to eql(7) }
20
+ end
21
+
22
+ context 'by_day with default offset' do
23
+ subject { Event.by_day(Time.zone.parse('2014-01-01')) }
24
+ it { expect(subject.count).to eql(5) }
25
+ end
26
+
27
+ context 'by_day with offset override' do
28
+ subject { Event.by_day(Time.zone.parse('2014-12-26'), field: :start_time, offset: 5.hours) }
29
+ it { expect(subject.count).to eql(0) }
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ shared_examples_for 'order parameter' do
4
+
5
+ describe ':order' do
6
+
7
+ if testing_active_record?
8
+
9
+ it 'should be able to order the result set asc' do
10
+ scope = Post.by_year(Time.zone.now.year, order: 'created_at ASC')
11
+ expect(scope.order_values).to eq ['created_at ASC']
12
+ expect(scope.first.created_at).to eq Time.zone.parse('2014-01-01 17:00:00')
13
+ end
14
+
15
+ it 'should be able to order the result set desc' do
16
+ scope = Post.by_year(Time.zone.now.year, order: 'created_at DESC')
17
+ expect(scope.order_values).to eq ['created_at DESC']
18
+ expect(scope.first.created_at).to eq Time.zone.parse('2014-04-15 17:00:00')
19
+ end
20
+
21
+ elsif testing_mongoid?
22
+
23
+ it 'should be able to order the result set asc' do
24
+ scope = Post.by_year(Time.zone.now.year, order: {created_at: :asc})
25
+ expect(scope.options[:sort]).to eq({'created_at' => 1})
26
+ expect(scope.first.created_at).to eq Time.zone.parse('2014-01-01 17:00:00')
27
+ end
28
+
29
+ it 'should be able to order the result set desc' do
30
+ scope = Post.by_year(Time.zone.now.year, order: {created_at: :desc})
31
+ expect(scope.options[:sort]).to eq({'created_at' => -1})
32
+ expect(scope.first.created_at).to eq Time.zone.parse('2014-04-15 17:00:00')
33
+ end
34
+ end
35
+ end
36
+ end
@@ -1,174 +1,174 @@
1
- require 'spec_helper'
2
-
3
- shared_examples_for 'relative' do
4
-
5
- describe '#past_day' do
6
- context 'point-in-time' do
7
- subject { Post.past_day }
8
- its(:count){ should eq 1 }
9
- end
10
-
11
- context 'timespan' do
12
- subject { Event.past_day }
13
- its(:count){ should eq 5 }
14
- end
15
-
16
- context 'timespan strict' do
17
- subject { Event.past_day(strict: true) }
18
- its(:count){ should eq 0 }
19
- end
20
- end
21
-
22
- describe '#past_week' do
23
- context 'point-in-time' do
24
- subject { Post.past_week }
25
- its(:count){ should eq 3 }
26
- end
27
-
28
- context 'timespan' do
29
- subject { Event.past_week }
30
- its(:count){ should eq 7 }
31
- end
32
-
33
- context 'timespan strict' do
34
- subject { Event.past_week(strict: true) }
35
- its(:count){ should eq 0 }
36
- end
37
- end
38
-
39
- describe '#past_fortnight' do
40
- context 'point-in-time' do
41
- subject { Post.past_fortnight }
42
- its(:count){ should eq 4 }
43
- end
44
-
45
- context 'timespan' do
46
- subject { Event.past_fortnight }
47
- its(:count){ should eq 8 }
48
- end
49
-
50
- context 'timespan strict' do
51
- subject { Event.past_fortnight(strict: true) }
52
- its(:count){ should eq 1 }
53
- end
54
- end
55
-
56
- describe '#past_month' do
57
- context 'point-in-time' do
58
- subject { Post.past_month }
59
- its(:count){ should eq 8 }
60
- end
61
-
62
- context 'timespan' do
63
- subject { Event.past_month }
64
- its(:count){ should eq 12 }
65
- end
66
-
67
- context 'timespan strict' do
68
- subject { Event.past_month(strict: true) }
69
- its(:count){ should eq 4 }
70
- end
71
- end
72
-
73
- describe '#past_year' do
74
- context 'point-in-time' do
75
- subject { Post.past_year }
76
- its(:count){ should eq 10 }
77
- end
78
-
79
- context 'timespan' do
80
- subject { Event.past_year }
81
- its(:count){ should eq 13 }
82
- end
83
-
84
- context 'timespan strict' do
85
- subject { Event.past_year(strict: true) }
86
- its(:count){ should eq 8 }
87
- end
88
- end
89
-
90
- describe '#next_day' do
91
- context 'point-in-time' do
92
- subject { Post.next_day }
93
- its(:count){ should eq 2 }
94
- end
95
-
96
- context 'timespan' do
97
- subject { Event.next_day }
98
- its(:count){ should eq 5 }
99
- end
100
-
101
- context 'timespan strict' do
102
- subject { Event.next_day(strict: true) }
103
- its(:count){ should eq 0 }
104
- end
105
- end
106
-
107
- describe '#next_week' do
108
- context 'point-in-time' do
109
- subject { Post.next_week }
110
- its(:count){ should eq 3 }
111
- end
112
-
113
- context 'timespan' do
114
- subject { Event.next_week }
115
- its(:count){ should eq 7 }
116
- end
117
-
118
- context 'timespan strict' do
119
- subject { Event.next_week(strict: true) }
120
- its(:count){ should eq 0 }
121
- end
122
- end
123
-
124
- describe '#next_fortnight' do
125
- context 'point-in-time' do
126
- subject { Post.next_fortnight }
127
- its(:count){ should eq 5 }
128
- end
129
-
130
- context 'timespan' do
131
- subject { Event.next_fortnight }
132
- its(:count){ should eq 7 }
133
- end
134
-
135
- context 'timespan strict' do
136
- subject { Event.next_fortnight(strict: true) }
137
- its(:count){ should eq 0 }
138
- end
139
- end
140
-
141
- describe '#next_month' do
142
- context 'point-in-time' do
143
- subject { Post.next_month }
144
- its(:count){ should eq 6 }
145
- end
146
-
147
- context 'timespan' do
148
- subject { Event.next_month }
149
- its(:count){ should eq 9 }
150
- end
151
-
152
- context 'timespan strict' do
153
- subject { Event.next_month(strict: true) }
154
- its(:count){ should eq 3 }
155
- end
156
- end
157
-
158
- describe '#next_year' do
159
- context 'point-in-time' do
160
- subject { Post.next_year }
161
- its(:count){ should eq 12 }
162
- end
163
-
164
- context 'timespan' do
165
- subject { Event.next_year }
166
- its(:count){ should eq 14 }
167
- end
168
-
169
- context 'timespan strict' do
170
- subject { Event.next_year(strict: true) }
171
- its(:count){ should eq 9 }
172
- end
173
- end
174
- end
1
+ require 'spec_helper'
2
+
3
+ shared_examples_for 'relative' do
4
+
5
+ describe '#past_day' do
6
+ context 'point-in-time' do
7
+ subject { Post.past_day }
8
+ it { expect(subject.count).to eql(1) }
9
+ end
10
+
11
+ context 'timespan' do
12
+ subject { Event.past_day }
13
+ it { expect(subject.count).to eql(5) }
14
+ end
15
+
16
+ context 'timespan strict' do
17
+ subject { Event.past_day(strict: true) }
18
+ it { expect(subject.count).to eql(0) }
19
+ end
20
+ end
21
+
22
+ describe '#past_week' do
23
+ context 'point-in-time' do
24
+ subject { Post.past_week }
25
+ it { expect(subject.count).to eql(3) }
26
+ end
27
+
28
+ context 'timespan' do
29
+ subject { Event.past_week }
30
+ it { expect(subject.count).to eql(7) }
31
+ end
32
+
33
+ context 'timespan strict' do
34
+ subject { Event.past_week(strict: true) }
35
+ it { expect(subject.count).to eql(0) }
36
+ end
37
+ end
38
+
39
+ describe '#past_fortnight' do
40
+ context 'point-in-time' do
41
+ subject { Post.past_fortnight }
42
+ it { expect(subject.count).to eql(4) }
43
+ end
44
+
45
+ context 'timespan' do
46
+ subject { Event.past_fortnight }
47
+ it { expect(subject.count).to eql(8) }
48
+ end
49
+
50
+ context 'timespan strict' do
51
+ subject { Event.past_fortnight(strict: true) }
52
+ it { expect(subject.count).to eql(1) }
53
+ end
54
+ end
55
+
56
+ describe '#past_month' do
57
+ context 'point-in-time' do
58
+ subject { Post.past_month }
59
+ it { expect(subject.count).to eql(8) }
60
+ end
61
+
62
+ context 'timespan' do
63
+ subject { Event.past_month }
64
+ it { expect(subject.count).to eql(12) }
65
+ end
66
+
67
+ context 'timespan strict' do
68
+ subject { Event.past_month(strict: true) }
69
+ it { expect(subject.count).to eql(4) }
70
+ end
71
+ end
72
+
73
+ describe '#past_year' do
74
+ context 'point-in-time' do
75
+ subject { Post.past_year }
76
+ it { expect(subject.count).to eql(10) }
77
+ end
78
+
79
+ context 'timespan' do
80
+ subject { Event.past_year }
81
+ it { expect(subject.count).to eql(13) }
82
+ end
83
+
84
+ context 'timespan strict' do
85
+ subject { Event.past_year(strict: true) }
86
+ it { expect(subject.count).to eql(8) }
87
+ end
88
+ end
89
+
90
+ describe '#next_day' do
91
+ context 'point-in-time' do
92
+ subject { Post.next_day }
93
+ it { expect(subject.count).to eql(2) }
94
+ end
95
+
96
+ context 'timespan' do
97
+ subject { Event.next_day }
98
+ it { expect(subject.count).to eql(5) }
99
+ end
100
+
101
+ context 'timespan strict' do
102
+ subject { Event.next_day(strict: true) }
103
+ it { expect(subject.count).to eql(0) }
104
+ end
105
+ end
106
+
107
+ describe '#next_week' do
108
+ context 'point-in-time' do
109
+ subject { Post.next_week }
110
+ it { expect(subject.count).to eql(3) }
111
+ end
112
+
113
+ context 'timespan' do
114
+ subject { Event.next_week }
115
+ it { expect(subject.count).to eql(7) }
116
+ end
117
+
118
+ context 'timespan strict' do
119
+ subject { Event.next_week(strict: true) }
120
+ it { expect(subject.count).to eql(0) }
121
+ end
122
+ end
123
+
124
+ describe '#next_fortnight' do
125
+ context 'point-in-time' do
126
+ subject { Post.next_fortnight }
127
+ it { expect(subject.count).to eql(5) }
128
+ end
129
+
130
+ context 'timespan' do
131
+ subject { Event.next_fortnight }
132
+ it { expect(subject.count).to eql(7) }
133
+ end
134
+
135
+ context 'timespan strict' do
136
+ subject { Event.next_fortnight(strict: true) }
137
+ it { expect(subject.count).to eql(0) }
138
+ end
139
+ end
140
+
141
+ describe '#next_month' do
142
+ context 'point-in-time' do
143
+ subject { Post.next_month }
144
+ it { expect(subject.count).to eql(6) }
145
+ end
146
+
147
+ context 'timespan' do
148
+ subject { Event.next_month }
149
+ it { expect(subject.count).to eql(9) }
150
+ end
151
+
152
+ context 'timespan strict' do
153
+ subject { Event.next_month(strict: true) }
154
+ it { expect(subject.count).to eql(3) }
155
+ end
156
+ end
157
+
158
+ describe '#next_year' do
159
+ context 'point-in-time' do
160
+ subject { Post.next_year }
161
+ it { expect(subject.count).to eql(12) }
162
+ end
163
+
164
+ context 'timespan' do
165
+ subject { Event.next_year }
166
+ it { expect(subject.count).to eql(14) }
167
+ end
168
+
169
+ context 'timespan strict' do
170
+ subject { Event.next_year(strict: true) }
171
+ it { expect(subject.count).to eql(9) }
172
+ end
173
+ end
174
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,29 +1,33 @@
1
- require 'rubygems'
2
- require 'bundler'
3
- Bundler.setup
4
- require 'fileutils'
5
- require 'logger'
6
-
7
- FileUtils.mkdir_p(File.dirname(__FILE__) + "/tmp")
8
- $:.unshift(File.join(File.dirname(__FILE__), "../lib"))
9
-
10
- require 'active_record'
11
- require 'mongoid'
12
- require 'chronic'
13
- require 'timecop'
14
- require 'by_star'
15
-
16
- # Specs should pass regardless of timezone
17
- Time.zone = %w(Asia/Tokyo America/New_York Australia/Sydney UTC).sample
18
- puts "Running specs in #{Time.zone} timezone..."
19
-
20
- # Set Rails time to 2014-01-01 00:00:00
21
- Timecop.travel(Time.zone.local(2014))
22
-
23
- def testing_mongoid?
24
- ENV['DB'] == 'mongodb' || ENV['DB'].nil?
25
- end
26
-
27
- def testing_active_record?
28
- ENV['DB'] != 'mongodb'
29
- end
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ Bundler.setup
4
+ require 'fileutils'
5
+ require 'logger'
6
+
7
+ FileUtils.mkdir_p(File.dirname(__FILE__) + "/tmp")
8
+ $:.unshift(File.join(File.dirname(__FILE__), "../lib"))
9
+
10
+ require 'active_record'
11
+ require 'mongoid'
12
+ require 'chronic'
13
+ require 'timecop'
14
+ require 'by_star'
15
+
16
+ # Specs should pass regardless of timezone
17
+ Time.zone = %w(Asia/Tokyo America/New_York Australia/Sydney UTC).sample
18
+ puts "Running specs in #{Time.zone} timezone..."
19
+
20
+ # Set Rails time to 2014-01-01 00:00:00
21
+ Timecop.travel(Time.zone.local(2014))
22
+
23
+ RSpec.configure do |c|
24
+ c.filter_run_excluding sydney: true unless Time.zone.name == 'Australia/Sydney'
25
+ end
26
+
27
+ def testing_mongoid?
28
+ ENV['DB'] == 'mongodb'
29
+ end
30
+
31
+ def testing_active_record?
32
+ !testing_mongoid?
33
+ end
@@ -0,0 +1,113 @@
1
+ require 'spec_helper'
2
+
3
+ describe Date do
4
+
5
+ describe '#in_time_zone' do
6
+
7
+ subject { Date.new }
8
+
9
+ before do
10
+ stub_const('Date', Class.new)
11
+ allow_any_instance_of(Date).to receive(:to_time_in_current_zone)
12
+ end
13
+
14
+ context 'when #in_time_zone is already defined' do
15
+ before do
16
+ expect_any_instance_of(Date).to receive(:in_time_zone)
17
+ end
18
+
19
+ context 'when ByStar::Kernel::InTimeZone included' do
20
+ before do
21
+ ::Date.__send__(:include, ByStar::Kernel::InTimeZone)
22
+ end
23
+
24
+ it 'should not be aliased to #to_time_in_current_zone' do
25
+ expect(subject).not_to receive(:to_time_in_current_zone)
26
+ subject.in_time_zone
27
+ end
28
+ end
29
+
30
+ context 'when ByStar::Kernel::InTimeZone not included' do
31
+
32
+ it 'should not be aliased to #to_time_in_current_zone' do
33
+ expect(subject).not_to receive(:to_time_in_current_zone)
34
+ subject.in_time_zone
35
+ end
36
+ end
37
+ end
38
+
39
+ context 'when #in_time_zone is not defined' do
40
+
41
+ context 'when ByStar::Kernel::InTimeZone included' do
42
+ before do
43
+ ::Date.__send__(:include, ByStar::Kernel::InTimeZone)
44
+ end
45
+
46
+ it 'should be aliased to #to_time_in_current_zone' do
47
+ expect(subject).to receive(:to_time_in_current_zone)
48
+ subject.in_time_zone
49
+ end
50
+ end
51
+
52
+ context 'when ByStar::Kernel::InTimeZone not included' do
53
+
54
+ it 'should raise NoMethodError' do
55
+ expect{ subject.in_time_zone }.to raise_error(NoMethodError)
56
+ end
57
+ end
58
+ end
59
+ end
60
+
61
+ describe 'weekend' do
62
+
63
+ (0..6).each do |n|
64
+ context "Monday plus #{n} days" do
65
+ subject { Date.parse('2014-01-06') + n.days }
66
+ it { expect(subject.beginning_of_weekend).to eq Date.parse('2014-01-11') }
67
+ it { expect(subject.end_of_weekend).to eq Date.parse('2014-01-12') }
68
+ end
69
+ end
70
+ end
71
+
72
+ describe 'fortnight' do
73
+
74
+ context 'first day of year' do
75
+ subject { Date.parse '2014-01-01' }
76
+ it { expect(subject.beginning_of_fortnight).to eq Date.parse('2014-01-01') }
77
+ it { expect(subject.end_of_fortnight).to eq Date.parse('2014-01-14') }
78
+ end
79
+
80
+ context 'second fortnight of year' do
81
+ subject { Date.parse '2014-01-16' }
82
+ it { expect(subject.beginning_of_fortnight).to eq Date.parse('2014-01-15') }
83
+ it { expect(subject.end_of_fortnight).to eq Date.parse('2014-01-28') }
84
+ end
85
+
86
+ context 'middle of year' do
87
+ subject { Date.parse '2014-06-13' }
88
+ it { expect(subject.beginning_of_fortnight).to eq Date.parse('2014-06-04') }
89
+ it { expect(subject.end_of_fortnight).to eq Date.parse('2014-06-17') }
90
+ end
91
+
92
+ context 'last day of year' do
93
+ subject { Date.parse '2014-12-31' }
94
+ it { expect(subject.beginning_of_fortnight).to eq Date.parse('2014-12-31') }
95
+ it { expect(subject.end_of_fortnight).to eq Date.parse('2015-01-13') }
96
+ end
97
+ end
98
+
99
+ describe 'calendar_month' do
100
+
101
+ subject { Date.parse '2014-01-01' }
102
+
103
+ context 'week begins Monday' do
104
+ it { expect(subject.beginning_of_calendar_month).to eq Date.parse('2013-12-30') }
105
+ it { expect(subject.end_of_calendar_month).to eq Date.parse('2014-02-02') }
106
+ end
107
+
108
+ context 'week begins Sunday' do
109
+ it { expect(subject.beginning_of_calendar_month(:sunday)).to eq Date.parse('2013-12-29') }
110
+ it { expect(subject.end_of_calendar_month(:sunday)).to eq Date.parse('2014-02-01') }
111
+ end
112
+ end
113
+ end