mongoid 7.3.2 → 7.3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/lib/config/locales/en.yml +13 -0
  4. data/lib/mongoid/association/embedded/batchable.rb +20 -1
  5. data/lib/mongoid/association/referenced/has_many/enumerable.rb +3 -7
  6. data/lib/mongoid/association/referenced/has_many/proxy.rb +2 -2
  7. data/lib/mongoid/association/relatable.rb +2 -0
  8. data/lib/mongoid/atomic/paths/embedded/many.rb +19 -0
  9. data/lib/mongoid/atomic.rb +26 -2
  10. data/lib/mongoid/config/environment.rb +9 -1
  11. data/lib/mongoid/contextual/atomic.rb +7 -2
  12. data/lib/mongoid/contextual/none.rb +3 -0
  13. data/lib/mongoid/criteria/queryable/selectable.rb +2 -2
  14. data/lib/mongoid/criteria/queryable/storable.rb +5 -5
  15. data/lib/mongoid/document.rb +3 -2
  16. data/lib/mongoid/errors/empty_config_file.rb +26 -0
  17. data/lib/mongoid/errors/invalid_config_file.rb +26 -0
  18. data/lib/mongoid/errors.rb +2 -0
  19. data/lib/mongoid/persistable/upsertable.rb +1 -1
  20. data/lib/mongoid/persistence_context.rb +3 -1
  21. data/lib/mongoid/query_cache.rb +11 -1
  22. data/lib/mongoid/tasks/database.rb +1 -1
  23. data/lib/mongoid/touchable.rb +10 -0
  24. data/lib/mongoid/version.rb +1 -1
  25. data/lib/rails/generators/mongoid/config/templates/mongoid.yml +7 -2
  26. data/spec/integration/associations/embeds_many_spec.rb +139 -0
  27. data/spec/integration/contextual/empty_spec.rb +142 -0
  28. data/spec/integration/stringified_symbol_field_spec.rb +2 -2
  29. data/spec/lite_spec_helper.rb +8 -1
  30. data/spec/mongoid/association/embedded/embeds_many/proxy_spec.rb +21 -0
  31. data/spec/mongoid/association/embedded/embeds_many_models.rb +137 -0
  32. data/spec/mongoid/association/referenced/belongs_to_query_spec.rb +20 -0
  33. data/spec/mongoid/association/referenced/has_and_belongs_to_many/proxy_spec.rb +8 -0
  34. data/spec/mongoid/association/referenced/has_many/enumerable_spec.rb +244 -92
  35. data/spec/mongoid/association/referenced/has_many/proxy_spec.rb +30 -14
  36. data/spec/mongoid/association/referenced/has_many_models.rb +17 -0
  37. data/spec/mongoid/clients/factory_spec.rb +9 -3
  38. data/spec/mongoid/clients/options_spec.rb +11 -5
  39. data/spec/mongoid/config/environment_spec.rb +86 -8
  40. data/spec/mongoid/config_spec.rb +89 -16
  41. data/spec/mongoid/contextual/atomic_spec.rb +64 -25
  42. data/spec/mongoid/contextual/geo_near_spec.rb +1 -1
  43. data/spec/mongoid/copyable_spec.rb +1 -1
  44. data/spec/mongoid/criteria_spec.rb +32 -0
  45. data/spec/mongoid/document_spec.rb +21 -1
  46. data/spec/mongoid/errors/invalid_config_file_spec.rb +32 -0
  47. data/spec/mongoid/persistable/updatable_spec.rb +2 -0
  48. data/spec/mongoid/query_cache_spec.rb +26 -2
  49. data/spec/mongoid/scopable_spec.rb +11 -0
  50. data/spec/mongoid/touchable_spec.rb +18 -0
  51. data/spec/mongoid/touchable_spec_models.rb +2 -0
  52. data/spec/shared/lib/mrss/cluster_config.rb +6 -1
  53. data/spec/shared/lib/mrss/constraints.rb +21 -4
  54. data/spec/shared/lib/mrss/event_subscriber.rb +200 -0
  55. data/spec/shared/lib/mrss/server_version_registry.rb +17 -12
  56. data/spec/shared/lib/mrss/session_registry.rb +69 -0
  57. data/spec/shared/lib/mrss/session_registry_legacy.rb +60 -0
  58. data/spec/shared/share/Dockerfile.erb +8 -7
  59. data/spec/shared/shlib/server.sh +72 -22
  60. data/spec/support/models/audible_sound.rb +3 -0
  61. data.tar.gz.sig +0 -0
  62. metadata +627 -608
  63. metadata.gz.sig +0 -0
  64. data/spec/support/session_registry.rb +0 -50
metadata.gz.sig CHANGED
Binary file
@@ -1,50 +0,0 @@
1
- require 'singleton'
2
-
3
- module Mongo
4
- class Client
5
- alias :get_session_without_tracking :get_session
6
-
7
- def get_session(options = {})
8
- get_session_without_tracking(options).tap do |session|
9
- SessionRegistry.instance.register(session)
10
- end
11
- end
12
- end
13
-
14
- class Session
15
- alias :end_session_without_tracking :end_session
16
-
17
- def end_session
18
- SessionRegistry.instance.unregister(self)
19
- end_session_without_tracking
20
- end
21
- end
22
- end
23
-
24
-
25
- class SessionRegistry
26
- include Singleton
27
-
28
- def initialize
29
- @registry = {}
30
- end
31
-
32
- def register(session)
33
- @registry[session.session_id] = session if session
34
- end
35
-
36
- def unregister(session)
37
- @registry.delete(session.session_id)
38
- end
39
-
40
- def verify_sessions_ended!
41
- unless @registry.empty?
42
- sessions = @registry.map { |_, session| session }
43
- raise "Session registry contains live sessions: #{sessions.join(', ')}"
44
- end
45
- end
46
-
47
- def clear_registry
48
- @registry = {}
49
- end
50
- end