birddog 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -254,7 +254,7 @@ module Birddog
254
254
  aggregate_scope = "_birddog_average"
255
255
  field_alias = $1
256
256
  field_name = $2
257
- when key =~ /^(sum_)([a-zA-Z_]*)/ && @sumable.include?($2.to_sym) then
257
+ when key =~ /^(sum_|total_)([a-zA-Z_]*)/ && @sumable.include?($2.to_sym) then
258
258
  aggregate_scope = "_birddog_sum"
259
259
  field_alias = $1
260
260
  field_name = $2
@@ -1,3 +1,3 @@
1
1
  module Birddog
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -95,12 +95,22 @@ describe Birddog::Birddog do
95
95
 
96
96
  it "creates a query on the column desired when scope is sum_*" do
97
97
  sql = Product.scopes_for_query("sum_value").to_sql
98
- sql.must_match(/sum/)
98
+ sql.must_match(/sum_value/)
99
+ end
100
+
101
+ it "creates a query on the column desired when scope is total_*" do
102
+ sql = Product.scopes_for_query("total_value").to_sql
103
+ sql.must_match(/total_value/)
99
104
  end
100
105
 
101
106
  it "calculates the sum and returns it in the result set" do
102
107
  avg = Product.scopes_for_query("sum_value").first
103
108
  avg.sum_value.must_equal(310)
104
109
  end
110
+
111
+ it "calculates the total and returns it in the result set" do
112
+ avg = Product.scopes_for_query("total_value").first
113
+ avg.total_value.must_equal(310)
114
+ end
105
115
  end
106
116
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: birddog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-02-29 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest
16
- requirement: &12901960 !ruby/object:Gem::Requirement
16
+ requirement: &11974160 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *12901960
24
+ version_requirements: *11974160
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &12901400 !ruby/object:Gem::Requirement
27
+ requirement: &11973660 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *12901400
35
+ version_requirements: *11973660
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: sqlite3-ruby
38
- requirement: &12900740 !ruby/object:Gem::Requirement
38
+ requirement: &11969740 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *12900740
46
+ version_requirements: *11969740
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: pry
49
- requirement: &12899920 !ruby/object:Gem::Requirement
49
+ requirement: &11969100 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *12899920
57
+ version_requirements: *11969100
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: chronic
60
- requirement: &12899480 !ruby/object:Gem::Requirement
60
+ requirement: &11968340 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *12899480
68
+ version_requirements: *11968340
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: activerecord
71
- requirement: &12899060 !ruby/object:Gem::Requirement
71
+ requirement: &11967900 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *12899060
79
+ version_requirements: *11967900
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: activesupport
82
- requirement: &12898400 !ruby/object:Gem::Requirement
82
+ requirement: &11967400 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *12898400
90
+ version_requirements: *11967400
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: squeel
93
- requirement: &12897540 !ruby/object:Gem::Requirement
93
+ requirement: &11966580 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,7 +98,7 @@ dependencies:
98
98
  version: '0'
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *12897540
101
+ version_requirements: *11966580
102
102
  description: Seeeeeeeee Readme
103
103
  email:
104
104
  - brandonsdewitt@gmail.com
@@ -139,7 +139,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
139
139
  version: '0'
140
140
  segments:
141
141
  - 0
142
- hash: -3806611019993035456
142
+ hash: -2053552367670732027
143
143
  required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  none: false
145
145
  requirements:
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  version: '0'
149
149
  segments:
150
150
  - 0
151
- hash: -3806611019993035456
151
+ hash: -2053552367670732027
152
152
  requirements: []
153
153
  rubyforge_project: birddog
154
154
  rubygems_version: 1.8.10