bullet 2.3.1 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. data/.travis.yml +5 -0
  2. data/Gemfile +3 -1
  3. data/Gemfile.lock +43 -32
  4. data/Gemfile.rails-2.3.14 +16 -0
  5. data/Gemfile.rails-2.3.14.lock +65 -0
  6. data/Gemfile.rails-3.0.12 +17 -0
  7. data/Gemfile.rails-3.0.12.lock +116 -0
  8. data/Gemfile.rails-3.1.4 +18 -0
  9. data/Gemfile.rails-3.1.4.lock +134 -0
  10. data/README.textile +5 -5
  11. data/lib/bullet.rb +15 -9
  12. data/lib/bullet/active_record2.rb +12 -0
  13. data/lib/bullet/active_record3.rb +12 -0
  14. data/lib/bullet/detector/association.rb +11 -12
  15. data/lib/bullet/detector/counter.rb +6 -6
  16. data/lib/bullet/detector/n_plus_one_query.rb +9 -9
  17. data/lib/bullet/detector/unused_eager_association.rb +9 -9
  18. data/lib/bullet/ext/object.rb +5 -0
  19. data/lib/bullet/ext/string.rb +5 -0
  20. data/lib/bullet/mongoid.rb +56 -0
  21. data/lib/bullet/registry/object.rb +4 -6
  22. data/lib/bullet/version.rb +1 -1
  23. data/spec/bullet/detector/association_spec.rb +14 -14
  24. data/spec/bullet/detector/counter_spec.rb +8 -9
  25. data/spec/bullet/detector/n_plus_one_query_spec.rb +22 -22
  26. data/spec/bullet/detector/unused_eager_association_spec.rb +7 -7
  27. data/spec/bullet/ext/object_spec.rb +20 -0
  28. data/spec/bullet/ext/string_spec.rb +13 -0
  29. data/spec/bullet/registry/object_spec.rb +4 -4
  30. data/spec/integration/association_spec.rb +463 -401
  31. data/spec/integration/counter_spec.rb +27 -25
  32. data/spec/integration/mongoid/association_spec.rb +276 -0
  33. data/spec/integration/rails2/association_spec.rb +593 -0
  34. data/spec/integration/rails2/counter_spec.rb +39 -0
  35. data/spec/models/mongoid/address.rb +5 -0
  36. data/spec/models/mongoid/category.rb +6 -0
  37. data/spec/models/mongoid/comment.rb +5 -0
  38. data/spec/models/mongoid/company.rb +5 -0
  39. data/spec/models/mongoid/entry.rb +5 -0
  40. data/spec/models/mongoid/post.rb +8 -0
  41. data/spec/models/post.rb +12 -6
  42. data/spec/spec_helper.rb +32 -8
  43. data/spec/support/bullet_ext.rb +1 -1
  44. data/spec/support/mongo_seed.rb +41 -0
  45. data/spec/support/{seed.rb → sqlite_seed.rb} +1 -22
  46. data/test.result +2293 -0
  47. metadata +42 -22
  48. data/spec/integration/association_for_chris_spec.rb +0 -37
  49. data/spec/integration/association_for_peschkaj_spec.rb +0 -26
  50. data/spec/models/contact.rb +0 -3
  51. data/spec/models/deal.rb +0 -4
  52. data/spec/models/email.rb +0 -3
  53. data/spec/models/hotel.rb +0 -4
  54. data/spec/models/location.rb +0 -3
@@ -1,4 +1,9 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
+ gemfile:
5
+ - Gemfile
6
+ - Gemfile.rails-3.1.4
7
+ - Gemfile.rails-3.0.12
8
+ - Gemfile.rails-2.3.14
4
9
  env: DB=sqlite
data/Gemfile CHANGED
@@ -4,10 +4,12 @@ source "http://rubygems.org"
4
4
 
5
5
  gemspec
6
6
 
7
- gem 'rails'
7
+ gem 'rails', '3.2.3'
8
8
  gem 'sqlite3'
9
9
  gem 'mysql'
10
10
  gem 'activerecord-import'
11
+ gem 'mongoid'
12
+ gem 'bson_ext'
11
13
 
12
14
  gem "rspec"
13
15
  gem "guard"
@@ -1,43 +1,46 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bullet (2.3.1)
4
+ bullet (4.0.0)
5
5
  uniform_notifier (~> 1.0.0)
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
- actionmailer (3.2.2)
11
- actionpack (= 3.2.2)
12
- mail (~> 2.4.0)
13
- actionpack (3.2.2)
14
- activemodel (= 3.2.2)
15
- activesupport (= 3.2.2)
10
+ actionmailer (3.2.3)
11
+ actionpack (= 3.2.3)
12
+ mail (~> 2.4.4)
13
+ actionpack (3.2.3)
14
+ activemodel (= 3.2.3)
15
+ activesupport (= 3.2.3)
16
16
  builder (~> 3.0.0)
17
17
  erubis (~> 2.7.0)
18
18
  journey (~> 1.0.1)
19
19
  rack (~> 1.4.0)
20
- rack-cache (~> 1.1)
20
+ rack-cache (~> 1.2)
21
21
  rack-test (~> 0.6.1)
22
22
  sprockets (~> 2.1.2)
23
- activemodel (3.2.2)
24
- activesupport (= 3.2.2)
23
+ activemodel (3.2.3)
24
+ activesupport (= 3.2.3)
25
25
  builder (~> 3.0.0)
26
- activerecord (3.2.2)
27
- activemodel (= 3.2.2)
28
- activesupport (= 3.2.2)
26
+ activerecord (3.2.3)
27
+ activemodel (= 3.2.3)
28
+ activesupport (= 3.2.3)
29
29
  arel (~> 3.0.2)
30
30
  tzinfo (~> 0.3.29)
31
31
  activerecord-import (0.2.9)
32
32
  activerecord (~> 3.0)
33
33
  activerecord (~> 3.0)
34
- activeresource (3.2.2)
35
- activemodel (= 3.2.2)
36
- activesupport (= 3.2.2)
37
- activesupport (3.2.2)
34
+ activeresource (3.2.3)
35
+ activemodel (= 3.2.3)
36
+ activesupport (= 3.2.3)
37
+ activesupport (3.2.3)
38
38
  i18n (~> 0.6)
39
39
  multi_json (~> 1.0)
40
40
  arel (3.0.2)
41
+ bson (1.6.2)
42
+ bson_ext (1.6.2)
43
+ bson (~> 1.6.2)
41
44
  builder (3.0.0)
42
45
  diff-lcs (1.1.3)
43
46
  erubis (2.7.0)
@@ -50,13 +53,19 @@ GEM
50
53
  hike (1.2.1)
51
54
  i18n (0.6.0)
52
55
  journey (1.0.3)
53
- json (1.6.5)
56
+ json (1.7.0)
54
57
  mail (2.4.4)
55
58
  i18n (>= 0.4.0)
56
59
  mime-types (~> 1.16)
57
60
  treetop (~> 1.4.8)
58
61
  mime-types (1.18)
59
- multi_json (1.1.0)
62
+ mongo (1.6.2)
63
+ bson (~> 1.6.2)
64
+ mongoid (2.4.9)
65
+ activemodel (~> 3.1)
66
+ mongo (~> 1.3)
67
+ tzinfo (~> 0.3.22)
68
+ multi_json (1.3.4)
60
69
  mysql (2.8.1)
61
70
  perftools.rb (2.0.0)
62
71
  polyglot (0.3.3)
@@ -67,17 +76,17 @@ GEM
67
76
  rack
68
77
  rack-test (0.6.1)
69
78
  rack (>= 1.0)
70
- rails (3.2.2)
71
- actionmailer (= 3.2.2)
72
- actionpack (= 3.2.2)
73
- activerecord (= 3.2.2)
74
- activeresource (= 3.2.2)
75
- activesupport (= 3.2.2)
79
+ rails (3.2.3)
80
+ actionmailer (= 3.2.3)
81
+ actionpack (= 3.2.3)
82
+ activerecord (= 3.2.3)
83
+ activeresource (= 3.2.3)
84
+ activesupport (= 3.2.3)
76
85
  bundler (~> 1.0)
77
- railties (= 3.2.2)
78
- railties (3.2.2)
79
- actionpack (= 3.2.2)
80
- activesupport (= 3.2.2)
86
+ railties (= 3.2.3)
87
+ railties (3.2.3)
88
+ actionpack (= 3.2.3)
89
+ activesupport (= 3.2.3)
81
90
  rack-ssl (~> 1.3.2)
82
91
  rake (>= 0.8.7)
83
92
  rdoc (~> 3.4)
@@ -93,7 +102,7 @@ GEM
93
102
  rspec-expectations (2.9.0)
94
103
  diff-lcs (~> 1.1.3)
95
104
  rspec-mocks (2.9.0)
96
- sprockets (2.1.2)
105
+ sprockets (2.1.3)
97
106
  hike (~> 1.2)
98
107
  rack (~> 1.0)
99
108
  tilt (~> 1.1, != 1.3.0)
@@ -103,7 +112,7 @@ GEM
103
112
  treetop (1.4.10)
104
113
  polyglot
105
114
  polyglot (>= 0.3.1)
106
- tzinfo (0.3.32)
115
+ tzinfo (0.3.33)
107
116
  uniform_notifier (1.0.2)
108
117
 
109
118
  PLATFORMS
@@ -111,11 +120,13 @@ PLATFORMS
111
120
 
112
121
  DEPENDENCIES
113
122
  activerecord-import
123
+ bson_ext
114
124
  bullet!
115
125
  guard
116
126
  guard-rspec
127
+ mongoid
117
128
  mysql
118
129
  perftools.rb
119
- rails
130
+ rails (= 3.2.3)
120
131
  rspec
121
132
  sqlite3
@@ -0,0 +1,16 @@
1
+ # Use `bundle install` in order to install these gems
2
+ # Use `bundle exec rake` in order to run the specs using the bundle
3
+ source "http://rubygems.org"
4
+
5
+ gemspec
6
+
7
+ gem 'rails', '2.3.14'
8
+ gem 'sqlite3'
9
+ gem 'mysql'
10
+ gem 'bson_ext'
11
+
12
+ gem "rspec"
13
+ gem "guard"
14
+ gem "guard-rspec"
15
+
16
+ gem "perftools.rb"
@@ -0,0 +1,65 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ bullet (2.3.1)
5
+ uniform_notifier (~> 1.0.0)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ actionmailer (2.3.14)
11
+ actionpack (= 2.3.14)
12
+ actionpack (2.3.14)
13
+ activesupport (= 2.3.14)
14
+ rack (~> 1.1.0)
15
+ activerecord (2.3.14)
16
+ activesupport (= 2.3.14)
17
+ activeresource (2.3.14)
18
+ activesupport (= 2.3.14)
19
+ activesupport (2.3.14)
20
+ bson (1.6.2)
21
+ bson_ext (1.6.2)
22
+ bson (~> 1.6.2)
23
+ diff-lcs (1.1.3)
24
+ ffi (1.0.11)
25
+ guard (1.0.2)
26
+ ffi (>= 0.5.0)
27
+ thor (~> 0.14.6)
28
+ guard-rspec (0.7.0)
29
+ guard (>= 0.10.0)
30
+ mysql (2.8.1)
31
+ perftools.rb (2.0.0)
32
+ rack (1.1.3)
33
+ rails (2.3.14)
34
+ actionmailer (= 2.3.14)
35
+ actionpack (= 2.3.14)
36
+ activerecord (= 2.3.14)
37
+ activeresource (= 2.3.14)
38
+ activesupport (= 2.3.14)
39
+ rake (>= 0.8.3)
40
+ rake (0.9.2.2)
41
+ rspec (2.10.0)
42
+ rspec-core (~> 2.10.0)
43
+ rspec-expectations (~> 2.10.0)
44
+ rspec-mocks (~> 2.10.0)
45
+ rspec-core (2.10.0)
46
+ rspec-expectations (2.10.0)
47
+ diff-lcs (~> 1.1.3)
48
+ rspec-mocks (2.10.1)
49
+ sqlite3 (1.3.6)
50
+ thor (0.14.6)
51
+ uniform_notifier (1.0.2)
52
+
53
+ PLATFORMS
54
+ ruby
55
+
56
+ DEPENDENCIES
57
+ bson_ext
58
+ bullet!
59
+ guard
60
+ guard-rspec
61
+ mysql
62
+ perftools.rb
63
+ rails (= 2.3.14)
64
+ rspec
65
+ sqlite3
@@ -0,0 +1,17 @@
1
+ # Use `bundle install` in order to install these gems
2
+ # Use `bundle exec rake` in order to run the specs using the bundle
3
+ source "http://rubygems.org"
4
+
5
+ gemspec
6
+
7
+ gem 'rails', '3.0.12'
8
+ gem 'sqlite3'
9
+ gem 'mysql'
10
+ gem 'activerecord-import'
11
+ gem 'bson_ext'
12
+
13
+ gem "rspec"
14
+ gem "guard"
15
+ gem "guard-rspec"
16
+
17
+ gem "perftools.rb"
@@ -0,0 +1,116 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ bullet (2.3.1)
5
+ uniform_notifier (~> 1.0.0)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ abstract (1.0.0)
11
+ actionmailer (3.0.12)
12
+ actionpack (= 3.0.12)
13
+ mail (~> 2.2.19)
14
+ actionpack (3.0.12)
15
+ activemodel (= 3.0.12)
16
+ activesupport (= 3.0.12)
17
+ builder (~> 2.1.2)
18
+ erubis (~> 2.6.6)
19
+ i18n (~> 0.5.0)
20
+ rack (~> 1.2.5)
21
+ rack-mount (~> 0.6.14)
22
+ rack-test (~> 0.5.7)
23
+ tzinfo (~> 0.3.23)
24
+ activemodel (3.0.12)
25
+ activesupport (= 3.0.12)
26
+ builder (~> 2.1.2)
27
+ i18n (~> 0.5.0)
28
+ activerecord (3.0.12)
29
+ activemodel (= 3.0.12)
30
+ activesupport (= 3.0.12)
31
+ arel (~> 2.0.10)
32
+ tzinfo (~> 0.3.23)
33
+ activerecord-import (0.2.9)
34
+ activerecord (~> 3.0)
35
+ activerecord (~> 3.0)
36
+ activeresource (3.0.12)
37
+ activemodel (= 3.0.12)
38
+ activesupport (= 3.0.12)
39
+ activesupport (3.0.12)
40
+ arel (2.0.10)
41
+ bson (1.6.2)
42
+ bson_ext (1.6.2)
43
+ bson (~> 1.6.2)
44
+ builder (2.1.2)
45
+ diff-lcs (1.1.3)
46
+ erubis (2.6.6)
47
+ abstract (>= 1.0.0)
48
+ ffi (1.0.11)
49
+ guard (1.0.2)
50
+ ffi (>= 0.5.0)
51
+ thor (~> 0.14.6)
52
+ guard-rspec (0.7.0)
53
+ guard (>= 0.10.0)
54
+ i18n (0.5.0)
55
+ json (1.7.0)
56
+ mail (2.2.19)
57
+ activesupport (>= 2.3.6)
58
+ i18n (>= 0.4.0)
59
+ mime-types (~> 1.16)
60
+ treetop (~> 1.4.8)
61
+ mime-types (1.18)
62
+ mysql (2.8.1)
63
+ perftools.rb (2.0.0)
64
+ polyglot (0.3.3)
65
+ rack (1.2.5)
66
+ rack-mount (0.6.14)
67
+ rack (>= 1.0.0)
68
+ rack-test (0.5.7)
69
+ rack (>= 1.0)
70
+ rails (3.0.12)
71
+ actionmailer (= 3.0.12)
72
+ actionpack (= 3.0.12)
73
+ activerecord (= 3.0.12)
74
+ activeresource (= 3.0.12)
75
+ activesupport (= 3.0.12)
76
+ bundler (~> 1.0)
77
+ railties (= 3.0.12)
78
+ railties (3.0.12)
79
+ actionpack (= 3.0.12)
80
+ activesupport (= 3.0.12)
81
+ rake (>= 0.8.7)
82
+ rdoc (~> 3.4)
83
+ thor (~> 0.14.4)
84
+ rake (0.9.2.2)
85
+ rdoc (3.12)
86
+ json (~> 1.4)
87
+ rspec (2.10.0)
88
+ rspec-core (~> 2.10.0)
89
+ rspec-expectations (~> 2.10.0)
90
+ rspec-mocks (~> 2.10.0)
91
+ rspec-core (2.10.0)
92
+ rspec-expectations (2.10.0)
93
+ diff-lcs (~> 1.1.3)
94
+ rspec-mocks (2.10.1)
95
+ sqlite3 (1.3.6)
96
+ thor (0.14.6)
97
+ treetop (1.4.10)
98
+ polyglot
99
+ polyglot (>= 0.3.1)
100
+ tzinfo (0.3.33)
101
+ uniform_notifier (1.0.2)
102
+
103
+ PLATFORMS
104
+ ruby
105
+
106
+ DEPENDENCIES
107
+ activerecord-import
108
+ bson_ext
109
+ bullet!
110
+ guard
111
+ guard-rspec
112
+ mysql
113
+ perftools.rb
114
+ rails (= 3.0.12)
115
+ rspec
116
+ sqlite3
@@ -0,0 +1,18 @@
1
+ # Use `bundle install` in order to install these gems
2
+ # Use `bundle exec rake` in order to run the specs using the bundle
3
+ source "http://rubygems.org"
4
+
5
+ gemspec
6
+
7
+ gem 'rails', '3.1.4'
8
+ gem 'sqlite3'
9
+ gem 'mysql'
10
+ gem 'activerecord-import'
11
+ gem 'mongoid'
12
+ gem 'bson_ext'
13
+
14
+ gem "rspec"
15
+ gem "guard"
16
+ gem "guard-rspec"
17
+
18
+ gem "perftools.rb"
@@ -0,0 +1,134 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ bullet (2.3.1)
5
+ uniform_notifier (~> 1.0.0)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ actionmailer (3.1.4)
11
+ actionpack (= 3.1.4)
12
+ mail (~> 2.3.0)
13
+ actionpack (3.1.4)
14
+ activemodel (= 3.1.4)
15
+ activesupport (= 3.1.4)
16
+ builder (~> 3.0.0)
17
+ erubis (~> 2.7.0)
18
+ i18n (~> 0.6)
19
+ rack (~> 1.3.6)
20
+ rack-cache (~> 1.1)
21
+ rack-mount (~> 0.8.2)
22
+ rack-test (~> 0.6.1)
23
+ sprockets (~> 2.0.3)
24
+ activemodel (3.1.4)
25
+ activesupport (= 3.1.4)
26
+ builder (~> 3.0.0)
27
+ i18n (~> 0.6)
28
+ activerecord (3.1.4)
29
+ activemodel (= 3.1.4)
30
+ activesupport (= 3.1.4)
31
+ arel (~> 2.2.3)
32
+ tzinfo (~> 0.3.29)
33
+ activerecord-import (0.2.9)
34
+ activerecord (~> 3.0)
35
+ activerecord (~> 3.0)
36
+ activeresource (3.1.4)
37
+ activemodel (= 3.1.4)
38
+ activesupport (= 3.1.4)
39
+ activesupport (3.1.4)
40
+ multi_json (~> 1.0)
41
+ arel (2.2.3)
42
+ bson (1.6.2)
43
+ bson_ext (1.6.2)
44
+ bson (~> 1.6.2)
45
+ builder (3.0.0)
46
+ diff-lcs (1.1.3)
47
+ erubis (2.7.0)
48
+ ffi (1.0.11)
49
+ guard (1.0.2)
50
+ ffi (>= 0.5.0)
51
+ thor (~> 0.14.6)
52
+ guard-rspec (0.7.0)
53
+ guard (>= 0.10.0)
54
+ hike (1.2.1)
55
+ i18n (0.6.0)
56
+ json (1.7.1)
57
+ mail (2.3.3)
58
+ i18n (>= 0.4.0)
59
+ mime-types (~> 1.16)
60
+ treetop (~> 1.4.8)
61
+ mime-types (1.18)
62
+ mongo (1.6.2)
63
+ bson (~> 1.6.2)
64
+ mongoid (2.4.9)
65
+ activemodel (~> 3.1)
66
+ mongo (~> 1.3)
67
+ tzinfo (~> 0.3.22)
68
+ multi_json (1.3.4)
69
+ mysql (2.8.1)
70
+ perftools.rb (2.0.0)
71
+ polyglot (0.3.3)
72
+ rack (1.3.6)
73
+ rack-cache (1.2)
74
+ rack (>= 0.4)
75
+ rack-mount (0.8.3)
76
+ rack (>= 1.0.0)
77
+ rack-ssl (1.3.2)
78
+ rack
79
+ rack-test (0.6.1)
80
+ rack (>= 1.0)
81
+ rails (3.1.4)
82
+ actionmailer (= 3.1.4)
83
+ actionpack (= 3.1.4)
84
+ activerecord (= 3.1.4)
85
+ activeresource (= 3.1.4)
86
+ activesupport (= 3.1.4)
87
+ bundler (~> 1.0)
88
+ railties (= 3.1.4)
89
+ railties (3.1.4)
90
+ actionpack (= 3.1.4)
91
+ activesupport (= 3.1.4)
92
+ rack-ssl (~> 1.3.2)
93
+ rake (>= 0.8.7)
94
+ rdoc (~> 3.4)
95
+ thor (~> 0.14.6)
96
+ rake (0.9.2.2)
97
+ rdoc (3.12)
98
+ json (~> 1.4)
99
+ rspec (2.10.0)
100
+ rspec-core (~> 2.10.0)
101
+ rspec-expectations (~> 2.10.0)
102
+ rspec-mocks (~> 2.10.0)
103
+ rspec-core (2.10.0)
104
+ rspec-expectations (2.10.0)
105
+ diff-lcs (~> 1.1.3)
106
+ rspec-mocks (2.10.1)
107
+ sprockets (2.0.4)
108
+ hike (~> 1.2)
109
+ rack (~> 1.0)
110
+ tilt (~> 1.1, != 1.3.0)
111
+ sqlite3 (1.3.6)
112
+ thor (0.14.6)
113
+ tilt (1.3.3)
114
+ treetop (1.4.10)
115
+ polyglot
116
+ polyglot (>= 0.3.1)
117
+ tzinfo (0.3.33)
118
+ uniform_notifier (1.0.2)
119
+
120
+ PLATFORMS
121
+ ruby
122
+
123
+ DEPENDENCIES
124
+ activerecord-import
125
+ bson_ext
126
+ bullet!
127
+ guard
128
+ guard-rspec
129
+ mongoid
130
+ mysql
131
+ perftools.rb
132
+ rails (= 3.1.4)
133
+ rspec
134
+ sqlite3