bullet 4.9.0 → 4.10.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 (50) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +1 -1
  3. data/.travis.yml +1 -1
  4. data/CHANGELOG.md +7 -0
  5. data/Gemfile +1 -3
  6. data/Gemfile.mongoid +2 -3
  7. data/Gemfile.mongoid-2.4 +0 -3
  8. data/Gemfile.mongoid-2.5 +0 -3
  9. data/Gemfile.mongoid-2.6 +0 -3
  10. data/Gemfile.mongoid-2.7 +0 -3
  11. data/Gemfile.mongoid-2.8 +0 -3
  12. data/Gemfile.mongoid-3.0 +0 -3
  13. data/Gemfile.mongoid-3.1 +0 -3
  14. data/Gemfile.mongoid-4.0 +19 -0
  15. data/Gemfile.rails-3.0 +0 -2
  16. data/Gemfile.rails-3.1 +1 -3
  17. data/Gemfile.rails-3.2 +1 -3
  18. data/Gemfile.rails-4.0 +1 -3
  19. data/Gemfile.rails-4.1 +1 -3
  20. data/README.md +19 -2
  21. data/bullet.gemspec +4 -2
  22. data/lib/bullet.rb +39 -10
  23. data/lib/bullet/active_record3.rb +20 -2
  24. data/lib/bullet/active_record3x.rb +20 -2
  25. data/lib/bullet/active_record4.rb +20 -2
  26. data/lib/bullet/active_record41.rb +20 -2
  27. data/lib/bullet/detector/association.rb +14 -25
  28. data/lib/bullet/detector/base.rb +0 -6
  29. data/lib/bullet/detector/counter_cache.rb +10 -12
  30. data/lib/bullet/detector/n_plus_one_query.rb +12 -8
  31. data/lib/bullet/detector/unused_eager_loading.rb +5 -1
  32. data/lib/bullet/mongoid3x.rb +5 -4
  33. data/lib/bullet/mongoid4x.rb +5 -4
  34. data/lib/bullet/version.rb +1 -1
  35. data/spec/bullet/detector/association_spec.rb +0 -19
  36. data/spec/bullet/detector/base_spec.rb +0 -6
  37. data/spec/bullet/detector/counter_cache_spec.rb +0 -8
  38. data/spec/bullet/detector/n_plus_one_query_spec.rb +0 -6
  39. data/spec/bullet/detector/unused_eager_loading_spec.rb +0 -7
  40. data/spec/bullet/rack_spec.rb +1 -7
  41. data/spec/bullet/registry/object_spec.rb +0 -1
  42. data/spec/bullet_spec.rb +41 -0
  43. data/spec/integration/active_record3/association_spec.rb +18 -75
  44. data/spec/integration/active_record4/association_spec.rb +16 -75
  45. data/spec/integration/counter_cache_spec.rb +1 -1
  46. data/spec/integration/mongoid/association_spec.rb +0 -10
  47. data/spec/spec_helper.rb +17 -0
  48. data/spec/support/mongo_seed.rb +1 -1
  49. data/test.sh +1 -0
  50. metadata +7 -3
@@ -55,9 +55,18 @@ if active_record?
55
55
  Support::SqliteSeed.setup_db
56
56
  Support::SqliteSeed.seed_db
57
57
  end
58
+
59
+ config.before(:each) do
60
+ Bullet.start_request
61
+ end
62
+
63
+ config.after(:each) do
64
+ Bullet.end_request
65
+ end
58
66
  end
59
67
 
60
68
  if ENV["LOG"]
69
+ require 'logger'
61
70
  ActiveRecord::Base.logger = Logger.new(STDOUT)
62
71
  end
63
72
  end
@@ -77,6 +86,14 @@ if mongoid?
77
86
  Support::MongoSeed.setup_db
78
87
  Support::MongoSeed.teardown_db
79
88
  end
89
+
90
+ config.before(:each) do
91
+ Bullet.start_request
92
+ end
93
+
94
+ config.after(:each) do
95
+ Bullet.end_request
96
+ end
80
97
  end
81
98
 
82
99
  if ENV["LOG"]
@@ -57,7 +57,7 @@ module Support
57
57
 
58
58
  def teardown_db
59
59
  Mongoid.purge!
60
- Mongoid::IdentityMap.clear
60
+ Mongoid::IdentityMap.clear if Mongoid.const_defined?(:IdentityMap)
61
61
  end
62
62
 
63
63
  extend self
data/test.sh CHANGED
@@ -5,6 +5,7 @@ BUNDLE_GEMFILE=Gemfile.rails-4.0 bundle && BUNDLE_GEMFILE=Gemfile.rails-4.0 bund
5
5
  BUNDLE_GEMFILE=Gemfile.rails-3.2 bundle && BUNDLE_GEMFILE=Gemfile.rails-3.2 bundle exec rspec spec
6
6
  BUNDLE_GEMFILE=Gemfile.rails-3.1 bundle && BUNDLE_GEMFILE=Gemfile.rails-3.1 bundle exec rspec spec
7
7
  BUNDLE_GEMFILE=Gemfile.rails-3.0 bundle && BUNDLE_GEMFILE=Gemfile.rails-3.0 bundle exec rspec spec
8
+ BUNDLE_GEMFILE=Gemfile.mongoid-4.0 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-4.0 bundle exec rspec spec
8
9
  BUNDLE_GEMFILE=Gemfile.mongoid-3.1 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-3.1 bundle exec rspec spec
9
10
  BUNDLE_GEMFILE=Gemfile.mongoid-3.0 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-3.0 bundle exec rspec spec
10
11
  BUNDLE_GEMFILE=Gemfile.mongoid-2.8 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-2.8 bundle exec rspec spec
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.9.0
4
+ version: 4.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-30 00:00:00.000000000 Z
11
+ date: 2014-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -58,6 +58,7 @@ files:
58
58
  - Gemfile.mongoid-2.8
59
59
  - Gemfile.mongoid-3.0
60
60
  - Gemfile.mongoid-3.1
61
+ - Gemfile.mongoid-4.0
61
62
  - Gemfile.rails-3.0
62
63
  - Gemfile.rails-3.1
63
64
  - Gemfile.rails-3.2
@@ -116,6 +117,7 @@ files:
116
117
  - spec/bullet/registry/association_spec.rb
117
118
  - spec/bullet/registry/base_spec.rb
118
119
  - spec/bullet/registry/object_spec.rb
120
+ - spec/bullet_spec.rb
119
121
  - spec/integration/active_record3/association_spec.rb
120
122
  - spec/integration/active_record4/association_spec.rb
121
123
  - spec/integration/counter_cache_spec.rb
@@ -159,7 +161,8 @@ files:
159
161
  - tasks/bullet_tasks.rake
160
162
  - test.sh
161
163
  homepage: http://github.com/flyerhzm/bullet
162
- licenses: []
164
+ licenses:
165
+ - MIT
163
166
  metadata: {}
164
167
  post_install_message:
165
168
  rdoc_options: []
@@ -198,6 +201,7 @@ test_files:
198
201
  - spec/bullet/registry/association_spec.rb
199
202
  - spec/bullet/registry/base_spec.rb
200
203
  - spec/bullet/registry/object_spec.rb
204
+ - spec/bullet_spec.rb
201
205
  - spec/integration/active_record3/association_spec.rb
202
206
  - spec/integration/active_record4/association_spec.rb
203
207
  - spec/integration/counter_cache_spec.rb