bullet 5.7.4 → 5.7.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/bullet.gemspec +2 -0
  4. data/lib/bullet.rb +2 -0
  5. data/lib/bullet/active_record4.rb +2 -0
  6. data/lib/bullet/active_record41.rb +2 -0
  7. data/lib/bullet/active_record42.rb +2 -0
  8. data/lib/bullet/active_record5.rb +2 -0
  9. data/lib/bullet/active_record52.rb +2 -0
  10. data/lib/bullet/dependency.rb +2 -0
  11. data/lib/bullet/detector.rb +2 -0
  12. data/lib/bullet/detector/association.rb +2 -0
  13. data/lib/bullet/detector/base.rb +2 -0
  14. data/lib/bullet/detector/counter_cache.rb +2 -0
  15. data/lib/bullet/detector/n_plus_one_query.rb +2 -0
  16. data/lib/bullet/detector/unused_eager_loading.rb +2 -0
  17. data/lib/bullet/ext/object.rb +2 -0
  18. data/lib/bullet/ext/string.rb +2 -0
  19. data/lib/bullet/mongoid4x.rb +6 -2
  20. data/lib/bullet/mongoid5x.rb +6 -2
  21. data/lib/bullet/mongoid6x.rb +2 -0
  22. data/lib/bullet/notification.rb +2 -0
  23. data/lib/bullet/notification/base.rb +2 -0
  24. data/lib/bullet/notification/counter_cache.rb +2 -0
  25. data/lib/bullet/notification/n_plus_one_query.rb +2 -0
  26. data/lib/bullet/notification/unused_eager_loading.rb +2 -0
  27. data/lib/bullet/notification_collector.rb +2 -0
  28. data/lib/bullet/rack.rb +10 -7
  29. data/lib/bullet/registry.rb +2 -0
  30. data/lib/bullet/registry/association.rb +2 -0
  31. data/lib/bullet/registry/base.rb +2 -0
  32. data/lib/bullet/registry/object.rb +2 -0
  33. data/lib/bullet/stack_trace_filter.rb +2 -0
  34. data/lib/bullet/version.rb +3 -1
  35. data/lib/generators/bullet/install_generator.rb +2 -0
  36. data/perf/benchmark.rb +2 -0
  37. data/rails/init.rb +2 -0
  38. data/spec/bullet/detector/association_spec.rb +2 -0
  39. data/spec/bullet/detector/base_spec.rb +2 -0
  40. data/spec/bullet/detector/counter_cache_spec.rb +2 -0
  41. data/spec/bullet/detector/n_plus_one_query_spec.rb +2 -0
  42. data/spec/bullet/detector/unused_eager_loading_spec.rb +2 -0
  43. data/spec/bullet/ext/object_spec.rb +2 -0
  44. data/spec/bullet/ext/string_spec.rb +2 -0
  45. data/spec/bullet/notification/base_spec.rb +2 -0
  46. data/spec/bullet/notification/counter_cache_spec.rb +2 -0
  47. data/spec/bullet/notification/n_plus_one_query_spec.rb +2 -0
  48. data/spec/bullet/notification/unused_eager_loading_spec.rb +2 -0
  49. data/spec/bullet/notification_collector_spec.rb +2 -0
  50. data/spec/bullet/rack_spec.rb +2 -0
  51. data/spec/bullet/registry/association_spec.rb +2 -0
  52. data/spec/bullet/registry/base_spec.rb +2 -0
  53. data/spec/bullet/registry/object_spec.rb +2 -0
  54. data/spec/bullet_spec.rb +2 -0
  55. data/spec/integration/active_record/association_spec.rb +2 -0
  56. data/spec/integration/counter_cache_spec.rb +2 -0
  57. data/spec/integration/mongoid/association_spec.rb +2 -0
  58. data/spec/models/address.rb +2 -0
  59. data/spec/models/author.rb +2 -0
  60. data/spec/models/base_user.rb +2 -0
  61. data/spec/models/category.rb +2 -0
  62. data/spec/models/city.rb +2 -0
  63. data/spec/models/client.rb +2 -0
  64. data/spec/models/comment.rb +2 -0
  65. data/spec/models/company.rb +2 -0
  66. data/spec/models/country.rb +2 -0
  67. data/spec/models/document.rb +2 -0
  68. data/spec/models/entry.rb +2 -0
  69. data/spec/models/firm.rb +2 -0
  70. data/spec/models/folder.rb +2 -0
  71. data/spec/models/mongoid/address.rb +2 -0
  72. data/spec/models/mongoid/category.rb +2 -0
  73. data/spec/models/mongoid/comment.rb +2 -0
  74. data/spec/models/mongoid/company.rb +2 -0
  75. data/spec/models/mongoid/entry.rb +2 -0
  76. data/spec/models/mongoid/post.rb +2 -0
  77. data/spec/models/mongoid/user.rb +2 -0
  78. data/spec/models/newspaper.rb +2 -0
  79. data/spec/models/page.rb +2 -0
  80. data/spec/models/person.rb +2 -0
  81. data/spec/models/pet.rb +2 -0
  82. data/spec/models/post.rb +2 -0
  83. data/spec/models/relationship.rb +2 -0
  84. data/spec/models/reply.rb +2 -0
  85. data/spec/models/student.rb +2 -0
  86. data/spec/models/submission.rb +2 -0
  87. data/spec/models/teacher.rb +2 -0
  88. data/spec/models/user.rb +2 -0
  89. data/spec/models/writer.rb +2 -0
  90. data/spec/spec_helper.rb +2 -0
  91. data/spec/support/bullet_ext.rb +2 -0
  92. data/spec/support/mongo_seed.rb +4 -2
  93. data/spec/support/rack_double.rb +2 -0
  94. data/spec/support/sqlite_seed.rb +4 -2
  95. data/tasks/bullet_tasks.rake +2 -0
  96. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8dc58f03ac00764a73d88e5687a32895d94abcac
4
- data.tar.gz: bd8d3b6215063a5536489aeaab2ffbdc72cb85e3
3
+ metadata.gz: fb27c10f2796dc6cc38899be2b88943f6c124d80
4
+ data.tar.gz: c89d95e08212b3bf8da49f2ce4c542ec2aa3021d
5
5
  SHA512:
6
- metadata.gz: c19ffb78e51f2307ce792759149e67a8f354db648b1aa0a0a746c5153c2337596ca067bbec8ed12df536bb455502438df50fc23dce1c05c1595e31b488ff1c33
7
- data.tar.gz: 784d901307fbd9ba2286d6281e25229ea11e580a81b2dd7d5514a20b713faa72902d2c79ab6804d0ed93c61859cd1bb36955374b16e4101353329b318a8fa8d3
6
+ metadata.gz: 8f4d67bebf52a6730fa623bb150717e56c052605fc339f37d89d915af0981e442200e2bfee5c3405e6269d0907dc4e4f89fd2965000e637555aa8614580837c0
7
+ data.tar.gz: 3fbfc65e37e50444107e153050b33f66fe51037fd9d325438015d51c71f4a5ccb387e9b76ba28a2c753c9f9227653686535c857f457c80d62213cdda070b9c18
@@ -1,5 +1,10 @@
1
1
  ## Next Release
2
2
 
3
+ ## 5.7.5 (12/03/2018)
4
+
5
+ * Fix duplicate logs in mongoid 4.x and 5.x version
6
+ * Add magic comment frozen_string_literal: true
7
+
3
8
  ## 5.7.4 (10/03/2018)
4
9
 
5
10
  * Avoid Bullet from making extra queries in mongoid6
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  lib = File.expand_path('../lib/', __FILE__)
2
4
  $LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_support/core_ext/module/delegation'
2
4
  require 'set'
3
5
  require 'uniform_notifier'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bullet
2
4
  module ActiveRecord
3
5
  def self.enable
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bullet
2
4
  module ActiveRecord
3
5
  def self.enable
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bullet
2
4
  module ActiveRecord
3
5
  def self.enable
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bullet
2
4
  module SaveWithBulletSupport
3
5
  def save(*args)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bullet
2
4
  module SaveWithBulletSupport
3
5
  def save(*args)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bullet
2
4
  module Dependency
3
5
  def mongoid?
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bullet
2
4
  module Detector
3
5
  autoload :Base, 'bullet/detector/base'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bullet
2
4
  module Detector
3
5
  class Association < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bullet
2
4
  module Detector
3
5
  class Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bullet
2
4
  module Detector
3
5
  class CounterCache < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bullet
2
4
  module Detector
3
5
  class NPlusOneQuery < Association
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bullet
2
4
  module Detector
3
5
  class UnusedEagerLoading < Association
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Object
2
4
  def bullet_key
3
5
  "#{self.class}:#{primary_key_value}"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class String
2
4
  def bullet_class_name
3
5
  sub(/:[^:]*?$/, ''.freeze)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bullet
2
4
  module Mongoid
3
5
  def self.enable
@@ -21,13 +23,15 @@ module Bullet
21
23
  end
22
24
 
23
25
  def each(&block)
24
- records = query.map { |doc| ::Mongoid::Factory.from_db(klass, doc) }
26
+ return to_enum unless block_given?
27
+ records = []
28
+ origin_each { |record| records << record }
25
29
  if records.length > 1
26
30
  Bullet::Detector::NPlusOneQuery.add_possible_objects(records)
27
31
  elsif records.size == 1
28
32
  Bullet::Detector::NPlusOneQuery.add_impossible_object(records.first)
29
33
  end
30
- origin_each(&block)
34
+ records.each(&block)
31
35
  end
32
36
 
33
37
  def eager_load(docs)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bullet
2
4
  module Mongoid
3
5
  def self.enable
@@ -21,13 +23,15 @@ module Bullet
21
23
  end
22
24
 
23
25
  def each(&block)
24
- records = view.map { |doc| ::Mongoid::Factory.from_db(klass, doc) }
26
+ return to_enum unless block_given?
27
+ records = []
28
+ origin_each { |record| records << record }
25
29
  if records.length > 1
26
30
  Bullet::Detector::NPlusOneQuery.add_possible_objects(records)
27
31
  elsif records.size == 1
28
32
  Bullet::Detector::NPlusOneQuery.add_impossible_object(records.first)
29
33
  end
30
- origin_each(&block)
34
+ records.each(&block)
31
35
  end
32
36
 
33
37
  def eager_load(docs)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bullet
2
4
  module Mongoid
3
5
  def self.enable
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bullet
2
4
  module Notification
3
5
  autoload :Base, 'bullet/notification/base'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bullet
2
4
  module Notification
3
5
  class Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bullet
2
4
  module Notification
3
5
  class CounterCache < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bullet
2
4
  module Notification
3
5
  class NPlusOneQuery < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bullet
2
4
  module Notification
3
5
  class UnusedEagerLoading < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'set'
2
4
 
3
5
  module Bullet
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bullet
2
4
  class Rack
3
5
  include Dependency
@@ -14,10 +16,10 @@ module Bullet
14
16
  response_body = nil
15
17
  if Bullet.notification?
16
18
  if !file?(headers) && !sse?(headers) && !empty?(response) &&
17
- status == 200 && !response_body(response).frozen? && html_request?(headers, response)
19
+ status == 200 && html_request?(headers, response)
18
20
  response_body = response_body(response)
19
- append_to_html_body(response_body, footer_note) if Bullet.add_footer
20
- append_to_html_body(response_body, Bullet.gather_inline_notifications)
21
+ response_body = append_to_html_body(response_body, footer_note) if Bullet.add_footer
22
+ response_body = append_to_html_body(response_body, Bullet.gather_inline_notifications)
21
23
  headers['Content-Length'] = response_body.bytesize.to_s
22
24
  end
23
25
  Bullet.perform_out_of_channel_notifications(env)
@@ -42,11 +44,12 @@ module Bullet
42
44
  end
43
45
 
44
46
  def append_to_html_body(response_body, content)
45
- if response_body.include?('</body>')
46
- position = response_body.rindex('</body>')
47
- response_body.insert(position, content)
47
+ body = response_body.dup
48
+ if body.include?('</body>')
49
+ position = body.rindex('</body>')
50
+ body.insert(position, content)
48
51
  else
49
- response_body << content
52
+ body << content
50
53
  end
51
54
  end
52
55
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bullet
2
4
  module Registry
3
5
  autoload :Base, 'bullet/registry/base'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bullet
2
4
  module Registry
3
5
  class Association < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bullet
2
4
  module Registry
3
5
  class Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bullet
2
4
  module Registry
3
5
  class Object < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bullet
2
4
  module StackTraceFilter
3
5
  VENDOR_PATH = '/vendor'.freeze
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bullet
2
- VERSION = '5.7.4'.freeze
4
+ VERSION = '5.7.5'.freeze
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bullet
2
4
  module Generators
3
5
  class InstallGenerator < ::Rails::Generators::Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  $LOAD_PATH << 'lib'
2
4
  require 'benchmark'
3
5
  require 'rails'
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bullet'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module Bullet
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module Bullet
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module Bullet
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module Bullet
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module Bullet
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Object do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe String do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module Bullet
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module Bullet
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module Bullet
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module Bullet
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module Bullet
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module Bullet
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module Bullet
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module Bullet
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module Bullet
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Bullet, focused: true do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  if active_record?
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  if !mongoid? && active_record?
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  if mongoid?
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Address < ActiveRecord::Base
2
4
  belongs_to :company
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Author < ActiveRecord::Base
2
4
  has_many :documents
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class BaseUser < ActiveRecord::Base
2
4
  has_many :comments
3
5
  has_many :posts
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Category < ActiveRecord::Base
2
4
  has_many :posts, inverse_of: :category
3
5
  has_many :entries
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class City < ActiveRecord::Base
2
4
  belongs_to :country
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Client < ActiveRecord::Base
2
4
  has_many :relationships
3
5
  has_many :firms, through: :relationships
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Comment < ActiveRecord::Base
2
4
  belongs_to :post, inverse_of: :comments
3
5
  belongs_to :author, class_name: 'BaseUser'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Company < ActiveRecord::Base
2
4
  has_one :address
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Country < ActiveRecord::Base
2
4
  has_many :cities
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Document < ActiveRecord::Base
2
4
  has_many :children, class_name: 'Document', foreign_key: 'parent_id'
3
5
  belongs_to :parent, class_name: 'Document', foreign_key: 'parent_id'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Entry < ActiveRecord::Base
2
4
  belongs_to :category
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Firm < ActiveRecord::Base
2
4
  has_many :relationships
3
5
  has_many :clients, through: :relationships
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Folder < Document
2
4
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Mongoid::Address
2
4
  include Mongoid::Document
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Mongoid::Category
2
4
  include Mongoid::Document
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Mongoid::Comment
2
4
  include Mongoid::Document
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Mongoid::Company
2
4
  include Mongoid::Document
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Mongoid::Entry
2
4
  include Mongoid::Document
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Mongoid::Post
2
4
  include Mongoid::Document
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Mongoid::User
2
4
  include Mongoid::Document
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Newspaper < ActiveRecord::Base
2
4
  has_many :writers, class_name: 'BaseUser'
3
5
  end
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Page < Document
2
4
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Person < ActiveRecord::Base
2
4
  has_many :pets
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Pet < ActiveRecord::Base
2
4
  belongs_to :person, counter_cache: true
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Post < ActiveRecord::Base
2
4
  belongs_to :category, inverse_of: :posts
3
5
  belongs_to :writer
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Relationship < ActiveRecord::Base
2
4
  belongs_to :firm
3
5
  belongs_to :client
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Reply < ActiveRecord::Base
2
4
  belongs_to :submission
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Student < ActiveRecord::Base
2
4
  has_and_belongs_to_many :teachers
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Submission < ActiveRecord::Base
2
4
  belongs_to :user
3
5
  has_many :replies
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Teacher < ActiveRecord::Base
2
4
  has_and_belongs_to_many :students
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class User < ActiveRecord::Base
2
4
  has_one :submission
3
5
  belongs_to :category
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Writer < BaseUser
2
4
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rspec'
2
4
  begin
3
5
  require 'active_record'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bullet
2
4
  def self.collected_notifications_of_class(notification_class)
3
5
  Bullet.notification_collector.collection.select do |notification|
@@ -1,5 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Support
2
4
  module MongoSeed
5
+ module_function
6
+
3
7
  def seed_db
4
8
  category1 = Mongoid::Category.create(name: 'first')
5
9
  category2 = Mongoid::Category.create(name: 'second')
@@ -64,7 +68,5 @@ module Support
64
68
  Mongoid.purge!
65
69
  Mongoid::IdentityMap.clear if Mongoid.const_defined?(:IdentityMap)
66
70
  end
67
-
68
- module_function
69
71
  end
70
72
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Support
2
4
  class AppDouble
3
5
  def call(_env)
@@ -1,5 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Support
2
4
  module SqliteSeed
5
+ module_function
6
+
3
7
  def seed_db
4
8
  newspaper1 = Newspaper.create(name: 'First Newspaper')
5
9
  newspaper2 = Newspaper.create(name: 'Second Newspaper')
@@ -231,7 +235,5 @@ module Support
231
235
  end
232
236
  end
233
237
  end
234
-
235
- module_function
236
238
  end
237
239
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  namespace :bullet do
2
4
  namespace :log do
3
5
  desc 'Truncates the bullet log file to zero bytes'
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: 5.7.4
4
+ version: 5.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-10 00:00:00.000000000 Z
11
+ date: 2018-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport