ar_aggregate_by_interval 1.1.6 → 1.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/ar_aggregate_by_interval/version.rb +1 -1
- data/spec/lib/ar_aggregate_by_interval_spec.rb +24 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1c961b3ed5d12203cc873a4594870eb7408f5a4
|
4
|
+
data.tar.gz: 0d3bd079ac028864d66b4b69f4908686dff8cf47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de4dc421547761903a03d2f2a2d7c20e83dfe702fe1364ed08628ed11ad10d9ac457f3ae554ef90b09ae72dde382b4507042e04654579135f9dc6054c836c057
|
7
|
+
data.tar.gz: 2bf2561984d1adde9aeaad18e99191726d372525aa01ba0f192e58d0ceb219bcecd844ca1673e85349772f192457326480229b5ca0c2ba01d478b10b86041f04
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.
|
|
3
3
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
4
|
This file adheres to [Keep a changelog](http://keepachangelog.com/).
|
5
5
|
|
6
|
+
## [1.1.7] - 2015-03-15 (maintenance)
|
7
|
+
### Added
|
8
|
+
- Tests for from and to parameters
|
9
|
+
|
6
10
|
## [1.1.6] - 2015-03-15 (maintenance)
|
7
11
|
### Added
|
8
12
|
- Tests run on MySQL, Postgres and SQLite
|
@@ -16,6 +16,11 @@ describe ArAggregateByInterval do
|
|
16
16
|
@to = @from
|
17
17
|
blog1 = Blog.create! arbitrary_number: 10, created_at: @from
|
18
18
|
blog2 = Blog.create! arbitrary_number: 20, created_at: @from
|
19
|
+
|
20
|
+
# extra row that should not be included in any of the calculations
|
21
|
+
# verifying that the from and to parameters are working
|
22
|
+
blog3 = Blog.create! arbitrary_number: 20, created_at: (@from + 2.week)
|
23
|
+
|
19
24
|
blog1.page_views.create! date: @from
|
20
25
|
blog1.page_views.create! date: @from
|
21
26
|
end
|
@@ -106,6 +111,25 @@ describe ArAggregateByInterval do
|
|
106
111
|
end
|
107
112
|
|
108
113
|
context 'normal args' do
|
114
|
+
|
115
|
+
context 'with to' do
|
116
|
+
subject do
|
117
|
+
Blog.count_weekly(:created_at, @from, @from)
|
118
|
+
end
|
119
|
+
it "returns only 1 results on #{db_config}" do
|
120
|
+
expect(subject.values.size).to eq 1
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
context 'without to, defaults to Time.now' do
|
125
|
+
subject do
|
126
|
+
Blog.count_weekly(:created_at, @from)
|
127
|
+
end
|
128
|
+
it "returns more than 1 result on #{db_config}" do
|
129
|
+
expect(subject.values.size).to be > 1
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
109
133
|
context 'for count' do
|
110
134
|
subject do
|
111
135
|
Blog.count_weekly(:created_at, @from, @from)
|