mongoid 7.3.5 → 7.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +17 -17
- data/README.md +2 -2
- data/lib/config/locales/en.yml +21 -20
- data/lib/mongoid/association/accessors.rb +0 -27
- data/lib/mongoid/association/bindable.rb +0 -21
- data/lib/mongoid/association/builders.rb +0 -9
- data/lib/mongoid/association/constrainable.rb +0 -3
- data/lib/mongoid/association/depending.rb +0 -7
- data/lib/mongoid/association/eager_loadable.rb +0 -3
- data/lib/mongoid/association/embedded/batchable.rb +12 -59
- data/lib/mongoid/association/embedded/cyclic.rb +2 -11
- data/lib/mongoid/association/embedded/embedded_in/binding.rb +0 -7
- data/lib/mongoid/association/embedded/embedded_in/buildable.rb +0 -3
- data/lib/mongoid/association/embedded/embedded_in/proxy.rb +0 -13
- data/lib/mongoid/association/embedded/embedded_in.rb +0 -23
- data/lib/mongoid/association/embedded/embeds_many/binding.rb +0 -7
- data/lib/mongoid/association/embedded/embeds_many/buildable.rb +0 -3
- data/lib/mongoid/association/embedded/embeds_many/proxy.rb +31 -44
- data/lib/mongoid/association/embedded/embeds_many.rb +0 -31
- data/lib/mongoid/association/embedded/embeds_one/binding.rb +0 -7
- data/lib/mongoid/association/embedded/embeds_one/buildable.rb +0 -3
- data/lib/mongoid/association/embedded/embeds_one/proxy.rb +26 -14
- data/lib/mongoid/association/embedded/embeds_one.rb +0 -27
- data/lib/mongoid/association/embedded.rb +0 -1
- data/lib/mongoid/association/macros.rb +6 -5
- data/lib/mongoid/association/many.rb +0 -17
- data/lib/mongoid/association/marshalable.rb +0 -5
- data/lib/mongoid/association/nested/many.rb +0 -11
- data/lib/mongoid/association/nested/nested_buildable.rb +0 -9
- data/lib/mongoid/association/nested/one.rb +1 -16
- data/lib/mongoid/association/nested.rb +0 -3
- data/lib/mongoid/association/one.rb +1 -10
- data/lib/mongoid/association/options.rb +0 -33
- data/lib/mongoid/association/proxy.rb +0 -21
- data/lib/mongoid/association/referenced/auto_save.rb +0 -9
- data/lib/mongoid/association/referenced/belongs_to/binding.rb +0 -7
- data/lib/mongoid/association/referenced/belongs_to/buildable.rb +4 -5
- data/lib/mongoid/association/referenced/belongs_to/eager.rb +0 -1
- data/lib/mongoid/association/referenced/belongs_to/proxy.rb +0 -13
- data/lib/mongoid/association/referenced/belongs_to.rb +9 -34
- data/lib/mongoid/association/referenced/counter_cache.rb +2 -15
- data/lib/mongoid/association/referenced/eager.rb +3 -24
- data/lib/mongoid/association/referenced/has_and_belongs_to_many/binding.rb +0 -5
- data/lib/mongoid/association/referenced/has_and_belongs_to_many/buildable.rb +0 -3
- data/lib/mongoid/association/referenced/has_and_belongs_to_many/eager.rb +0 -1
- data/lib/mongoid/association/referenced/has_and_belongs_to_many/proxy.rb +12 -39
- data/lib/mongoid/association/referenced/has_and_belongs_to_many.rb +11 -38
- data/lib/mongoid/association/referenced/has_many/binding.rb +0 -5
- data/lib/mongoid/association/referenced/has_many/buildable.rb +0 -3
- data/lib/mongoid/association/referenced/has_many/eager.rb +0 -1
- data/lib/mongoid/association/referenced/has_many/enumerable.rb +8 -56
- data/lib/mongoid/association/referenced/has_many/proxy.rb +20 -63
- data/lib/mongoid/association/referenced/has_many.rb +12 -39
- data/lib/mongoid/association/referenced/has_one/binding.rb +0 -7
- data/lib/mongoid/association/referenced/has_one/buildable.rb +3 -4
- data/lib/mongoid/association/referenced/has_one/eager.rb +0 -1
- data/lib/mongoid/association/referenced/has_one/nested_builder.rb +0 -15
- data/lib/mongoid/association/referenced/has_one/proxy.rb +0 -9
- data/lib/mongoid/association/referenced/has_one.rb +9 -32
- data/lib/mongoid/association/referenced/syncable.rb +0 -17
- data/lib/mongoid/association/referenced.rb +0 -1
- data/lib/mongoid/association/reflections.rb +0 -1
- data/lib/mongoid/association/relatable.rb +0 -61
- data/lib/mongoid/association.rb +0 -17
- data/lib/mongoid/atomic/modifiers.rb +4 -51
- data/lib/mongoid/atomic/paths/embedded/many.rb +0 -24
- data/lib/mongoid/atomic/paths/embedded/one.rb +0 -5
- data/lib/mongoid/atomic/paths/embedded.rb +0 -3
- data/lib/mongoid/atomic/paths/root.rb +0 -5
- data/lib/mongoid/atomic/paths.rb +0 -1
- data/lib/mongoid/atomic.rb +1 -42
- data/lib/mongoid/attributes/dynamic.rb +0 -17
- data/lib/mongoid/attributes/nested.rb +0 -5
- data/lib/mongoid/attributes/processing.rb +1 -18
- data/lib/mongoid/attributes/projector.rb +0 -1
- data/lib/mongoid/attributes/readonly.rb +0 -5
- data/lib/mongoid/attributes.rb +0 -33
- data/lib/mongoid/cacheable.rb +1 -6
- data/lib/mongoid/changeable.rb +3 -59
- data/lib/mongoid/clients/factory.rb +0 -7
- data/lib/mongoid/clients/options.rb +0 -5
- data/lib/mongoid/clients/sessions.rb +0 -7
- data/lib/mongoid/clients/storage_options.rb +0 -7
- data/lib/mongoid/clients/validators/storage.rb +0 -9
- data/lib/mongoid/clients/validators.rb +0 -1
- data/lib/mongoid/clients.rb +0 -9
- data/lib/mongoid/composable.rb +0 -7
- data/lib/mongoid/config/environment.rb +5 -6
- data/lib/mongoid/config/options.rb +0 -11
- data/lib/mongoid/config/validators/client.rb +0 -17
- data/lib/mongoid/config/validators/option.rb +0 -3
- data/lib/mongoid/config/validators.rb +0 -1
- data/lib/mongoid/config.rb +37 -29
- data/lib/mongoid/contextual/aggregable/memory.rb +14 -11
- data/lib/mongoid/contextual/aggregable/mongo.rb +15 -20
- data/lib/mongoid/contextual/aggregable/none.rb +65 -0
- data/lib/mongoid/contextual/aggregable.rb +17 -0
- data/lib/mongoid/contextual/atomic.rb +0 -25
- data/lib/mongoid/contextual/command.rb +0 -5
- data/lib/mongoid/contextual/geo_near.rb +1 -34
- data/lib/mongoid/contextual/map_reduce.rb +0 -31
- data/lib/mongoid/contextual/memory.rb +4 -59
- data/lib/mongoid/contextual/mongo.rb +132 -78
- data/lib/mongoid/contextual/none.rb +39 -28
- data/lib/mongoid/contextual/queryable.rb +0 -3
- data/lib/mongoid/contextual.rb +0 -5
- data/lib/mongoid/copyable.rb +0 -5
- data/lib/mongoid/criteria/findable.rb +0 -13
- data/lib/mongoid/criteria/includable.rb +0 -9
- data/lib/mongoid/criteria/inspectable.rb +0 -3
- data/lib/mongoid/criteria/marshalable.rb +0 -5
- data/lib/mongoid/criteria/modifiable.rb +0 -19
- data/lib/mongoid/criteria/options.rb +0 -3
- data/lib/mongoid/criteria/permission.rb +0 -1
- data/lib/mongoid/criteria/queryable/aggregable.rb +0 -13
- data/lib/mongoid/criteria/queryable/expandable.rb +0 -1
- data/lib/mongoid/criteria/queryable/extensions/array.rb +1 -26
- data/lib/mongoid/criteria/queryable/extensions/big_decimal.rb +0 -3
- data/lib/mongoid/criteria/queryable/extensions/boolean.rb +0 -3
- data/lib/mongoid/criteria/queryable/extensions/date.rb +0 -7
- data/lib/mongoid/criteria/queryable/extensions/date_time.rb +0 -5
- data/lib/mongoid/criteria/queryable/extensions/hash.rb +0 -25
- data/lib/mongoid/criteria/queryable/extensions/nil_class.rb +0 -13
- data/lib/mongoid/criteria/queryable/extensions/numeric.rb +0 -11
- data/lib/mongoid/criteria/queryable/extensions/object.rb +1 -28
- data/lib/mongoid/criteria/queryable/extensions/range.rb +38 -16
- data/lib/mongoid/criteria/queryable/extensions/regexp.rb +0 -9
- data/lib/mongoid/criteria/queryable/extensions/set.rb +0 -3
- data/lib/mongoid/criteria/queryable/extensions/string.rb +0 -17
- data/lib/mongoid/criteria/queryable/extensions/symbol.rb +0 -9
- data/lib/mongoid/criteria/queryable/extensions/time.rb +0 -7
- data/lib/mongoid/criteria/queryable/extensions/time_with_zone.rb +0 -7
- data/lib/mongoid/criteria/queryable/extensions.rb +0 -1
- data/lib/mongoid/criteria/queryable/key.rb +1 -14
- data/lib/mongoid/criteria/queryable/macroable.rb +0 -3
- data/lib/mongoid/criteria/queryable/mergeable.rb +1 -30
- data/lib/mongoid/criteria/queryable/optional.rb +0 -45
- data/lib/mongoid/criteria/queryable/options.rb +0 -19
- data/lib/mongoid/criteria/queryable/pipeline.rb +0 -13
- data/lib/mongoid/criteria/queryable/selectable.rb +20 -67
- data/lib/mongoid/criteria/queryable/selector.rb +0 -17
- data/lib/mongoid/criteria/queryable/smash.rb +0 -11
- data/lib/mongoid/criteria/queryable/storable.rb +6 -2
- data/lib/mongoid/criteria/queryable.rb +0 -7
- data/lib/mongoid/criteria/scopable.rb +25 -19
- data/lib/mongoid/criteria.rb +0 -57
- data/lib/mongoid/document.rb +0 -51
- data/lib/mongoid/equality.rb +26 -10
- data/lib/mongoid/errors/ambiguous_relationship.rb +2 -5
- data/lib/mongoid/errors/callback.rb +0 -3
- data/lib/mongoid/errors/criteria_argument_required.rb +0 -1
- data/lib/mongoid/errors/delete_restriction.rb +0 -3
- data/lib/mongoid/errors/document_not_destroyed.rb +2 -7
- data/lib/mongoid/errors/document_not_found.rb +0 -9
- data/lib/mongoid/errors/eager_load.rb +0 -3
- data/lib/mongoid/errors/empty_config_file.rb +0 -1
- data/lib/mongoid/errors/in_memory_collation_not_supported.rb +0 -3
- data/lib/mongoid/errors/invalid_collection.rb +0 -1
- data/lib/mongoid/errors/invalid_config_file.rb +0 -1
- data/lib/mongoid/errors/invalid_config_option.rb +0 -3
- data/lib/mongoid/errors/invalid_dependent_strategy.rb +0 -3
- data/lib/mongoid/errors/invalid_discriminator_key_target.rb +0 -1
- data/lib/mongoid/errors/invalid_elem_match_operator.rb +0 -1
- data/lib/mongoid/errors/invalid_estimated_count_criteria.rb +0 -1
- data/lib/mongoid/errors/invalid_expression_operator.rb +0 -1
- data/lib/mongoid/errors/invalid_field.rb +0 -5
- data/lib/mongoid/errors/invalid_field_operator.rb +0 -1
- data/lib/mongoid/errors/invalid_field_option.rb +0 -3
- data/lib/mongoid/errors/invalid_find.rb +0 -3
- data/lib/mongoid/errors/invalid_includes.rb +0 -3
- data/lib/mongoid/errors/invalid_index.rb +0 -3
- data/lib/mongoid/errors/invalid_options.rb +0 -3
- data/lib/mongoid/errors/invalid_path.rb +0 -3
- data/lib/mongoid/errors/invalid_persistence_option.rb +0 -5
- data/lib/mongoid/errors/invalid_query.rb +0 -1
- data/lib/mongoid/errors/invalid_relation.rb +0 -7
- data/lib/mongoid/errors/invalid_relation_option.rb +0 -3
- data/lib/mongoid/errors/invalid_scope.rb +0 -3
- data/lib/mongoid/errors/invalid_session_use.rb +1 -6
- data/lib/mongoid/errors/invalid_set_polymorphic_relation.rb +0 -1
- data/lib/mongoid/errors/invalid_storage_options.rb +0 -3
- data/lib/mongoid/errors/invalid_storage_parent.rb +0 -3
- data/lib/mongoid/errors/invalid_time.rb +0 -3
- data/lib/mongoid/errors/invalid_value.rb +0 -1
- data/lib/mongoid/errors/inverse_not_found.rb +0 -3
- data/lib/mongoid/errors/mixed_client_configuration.rb +0 -3
- data/lib/mongoid/errors/mixed_relations.rb +0 -3
- data/lib/mongoid/errors/mongoid_error.rb +0 -9
- data/lib/mongoid/errors/nested_attributes_metadata_not_found.rb +0 -3
- data/lib/mongoid/errors/no_client_config.rb +0 -3
- data/lib/mongoid/errors/no_client_database.rb +0 -3
- data/lib/mongoid/errors/no_client_hosts.rb +0 -3
- data/lib/mongoid/errors/no_clients_config.rb +0 -3
- data/lib/mongoid/errors/no_default_client.rb +0 -3
- data/lib/mongoid/errors/no_environment.rb +0 -3
- data/lib/mongoid/errors/no_map_reduce_output.rb +0 -3
- data/lib/mongoid/errors/no_metadata.rb +0 -3
- data/lib/mongoid/errors/no_parent.rb +0 -3
- data/lib/mongoid/errors/readonly_attribute.rb +0 -3
- data/lib/mongoid/errors/readonly_document.rb +1 -6
- data/lib/mongoid/errors/scope_overwrite.rb +0 -1
- data/lib/mongoid/errors/too_many_nested_attribute_records.rb +0 -1
- data/lib/mongoid/errors/unknown_attribute.rb +0 -3
- data/lib/mongoid/errors/unknown_model.rb +0 -3
- data/lib/mongoid/errors/unsaved_document.rb +1 -2
- data/lib/mongoid/errors/unsupported_javascript.rb +0 -3
- data/lib/mongoid/errors/validations.rb +0 -1
- data/lib/mongoid/errors.rb +0 -1
- data/lib/mongoid/evolvable.rb +0 -3
- data/lib/mongoid/extensions/array.rb +3 -29
- data/lib/mongoid/extensions/big_decimal.rb +0 -11
- data/lib/mongoid/extensions/boolean.rb +0 -3
- data/lib/mongoid/extensions/date.rb +0 -9
- data/lib/mongoid/extensions/date_time.rb +0 -9
- data/lib/mongoid/extensions/decimal128.rb +0 -5
- data/lib/mongoid/extensions/false_class.rb +1 -6
- data/lib/mongoid/extensions/float.rb +0 -7
- data/lib/mongoid/extensions/hash.rb +0 -27
- data/lib/mongoid/extensions/integer.rb +0 -9
- data/lib/mongoid/extensions/module.rb +0 -3
- data/lib/mongoid/extensions/nil_class.rb +0 -5
- data/lib/mongoid/extensions/object.rb +1 -40
- data/lib/mongoid/extensions/object_id.rb +0 -7
- data/lib/mongoid/extensions/range.rb +0 -11
- data/lib/mongoid/extensions/regexp.rb +0 -3
- data/lib/mongoid/extensions/set.rb +0 -7
- data/lib/mongoid/extensions/string.rb +1 -30
- data/lib/mongoid/extensions/symbol.rb +0 -7
- data/lib/mongoid/extensions/time.rb +0 -11
- data/lib/mongoid/extensions/time_with_zone.rb +13 -9
- data/lib/mongoid/extensions/true_class.rb +1 -6
- data/lib/mongoid/extensions.rb +15 -3
- data/lib/mongoid/factory.rb +1 -2
- data/lib/mongoid/fields/foreign_key.rb +0 -21
- data/lib/mongoid/fields/localized.rb +0 -11
- data/lib/mongoid/fields/standard.rb +0 -33
- data/lib/mongoid/fields/validators/macro.rb +0 -9
- data/lib/mongoid/fields/validators.rb +0 -1
- data/lib/mongoid/fields.rb +64 -57
- data/lib/mongoid/findable.rb +0 -5
- data/lib/mongoid/indexable/specification.rb +0 -15
- data/lib/mongoid/indexable/validators/options.rb +0 -7
- data/lib/mongoid/indexable.rb +1 -18
- data/lib/mongoid/inspectable.rb +1 -10
- data/lib/mongoid/interceptable.rb +0 -25
- data/lib/mongoid/loggable.rb +0 -9
- data/lib/mongoid/matchable.rb +0 -5
- data/lib/mongoid/matcher/eq_impl.rb +37 -2
- data/lib/mongoid/matcher/eq_impl_with_regexp.rb +6 -1
- data/lib/mongoid/persistable/creatable.rb +1 -20
- data/lib/mongoid/persistable/deletable.rb +0 -17
- data/lib/mongoid/persistable/destroyable.rb +0 -7
- data/lib/mongoid/persistable/incrementable.rb +0 -5
- data/lib/mongoid/persistable/logical.rb +0 -5
- data/lib/mongoid/persistable/poppable.rb +0 -5
- data/lib/mongoid/persistable/pullable.rb +0 -7
- data/lib/mongoid/persistable/pushable.rb +0 -7
- data/lib/mongoid/persistable/renamable.rb +0 -5
- data/lib/mongoid/persistable/savable.rb +0 -7
- data/lib/mongoid/persistable/settable.rb +0 -5
- data/lib/mongoid/persistable/unsettable.rb +0 -5
- data/lib/mongoid/persistable/updatable.rb +2 -17
- data/lib/mongoid/persistable/upsertable.rb +1 -8
- data/lib/mongoid/persistable.rb +0 -23
- data/lib/mongoid/persistence_context.rb +0 -27
- data/lib/mongoid/positional.rb +0 -5
- data/lib/mongoid/query_cache.rb +0 -33
- data/lib/mongoid/railtie.rb +0 -15
- data/lib/mongoid/railties/controller_runtime.rb +0 -1
- data/lib/mongoid/reloadable.rb +4 -16
- data/lib/mongoid/scopable.rb +6 -34
- data/lib/mongoid/selectable.rb +0 -9
- data/lib/mongoid/serializable.rb +0 -15
- data/lib/mongoid/shardable.rb +0 -7
- data/lib/mongoid/stateful.rb +0 -9
- data/lib/mongoid/stringified_symbol.rb +2 -3
- data/lib/mongoid/tasks/database.rb +0 -5
- data/lib/mongoid/threaded/lifecycle.rb +0 -21
- data/lib/mongoid/threaded.rb +0 -55
- data/lib/mongoid/timestamps/created/short.rb +0 -1
- data/lib/mongoid/timestamps/created.rb +0 -1
- data/lib/mongoid/timestamps/short.rb +0 -1
- data/lib/mongoid/timestamps/timeless.rb +0 -7
- data/lib/mongoid/timestamps/updated/short.rb +0 -1
- data/lib/mongoid/timestamps/updated.rb +0 -3
- data/lib/mongoid/timestamps.rb +0 -1
- data/lib/mongoid/touchable.rb +0 -7
- data/lib/mongoid/traversable.rb +64 -53
- data/lib/mongoid/validatable/associated.rb +0 -3
- data/lib/mongoid/validatable/format.rb +0 -1
- data/lib/mongoid/validatable/length.rb +0 -1
- data/lib/mongoid/validatable/localizable.rb +0 -3
- data/lib/mongoid/validatable/macros.rb +0 -7
- data/lib/mongoid/validatable/presence.rb +1 -8
- data/lib/mongoid/validatable/queryable.rb +0 -3
- data/lib/mongoid/validatable/uniqueness.rb +15 -30
- data/lib/mongoid/validatable.rb +1 -22
- data/lib/mongoid/version.rb +1 -2
- data/lib/mongoid.rb +0 -15
- data/lib/rails/generators/mongoid/config/config_generator.rb +0 -1
- data/lib/rails/generators/mongoid/config/templates/mongoid.yml +2 -7
- data/lib/rails/generators/mongoid/model/model_generator.rb +0 -1
- data/lib/rails/generators/mongoid_generator.rb +0 -1
- data/lib/rails/mongoid.rb +0 -3
- data/spec/integration/app_spec.rb +0 -1
- data/spec/integration/associations/belongs_to_spec.rb +0 -1
- data/spec/integration/associations/embedded_dirty_spec.rb +29 -0
- data/spec/integration/associations/embedded_spec.rb +0 -1
- data/spec/integration/associations/embeds_many_spec.rb +0 -1
- data/spec/integration/associations/embeds_one_spec.rb +0 -1
- data/spec/integration/associations/foreign_key_spec.rb +0 -1
- data/spec/integration/associations/foreign_key_spec_models.rb +0 -1
- data/spec/integration/associations/has_many_spec.rb +0 -1
- data/spec/integration/associations/has_one_spec.rb +0 -1
- data/spec/integration/associations/nested_attributes_assignment_spec.rb +0 -1
- data/spec/integration/associations/reverse_population_spec.rb +0 -1
- data/spec/integration/associations/reverse_population_spec_models.rb +0 -1
- data/spec/integration/associations/scope_option_spec.rb +101 -0
- data/spec/integration/atomic/modifiers_spec.rb +0 -1
- data/spec/integration/bson_regexp_raw_spec.rb +0 -1
- data/spec/integration/callbacks_models.rb +12 -0
- data/spec/integration/callbacks_spec.rb +18 -6
- data/spec/integration/contextual/empty_spec.rb +0 -1
- data/spec/integration/criteria/alias_query_spec.rb +161 -0
- data/spec/integration/criteria/date_field_spec.rb +0 -1
- data/spec/integration/criteria/default_scope_spec.rb +51 -0
- data/spec/integration/criteria/logical_spec.rb +30 -0
- data/spec/integration/criteria/range_spec.rb +265 -0
- data/spec/integration/criteria/time_with_zone_spec.rb +125 -15
- data/spec/integration/discriminator_key_spec.rb +0 -1
- data/spec/integration/discriminator_value_spec.rb +0 -1
- data/spec/integration/document_spec.rb +0 -1
- data/spec/integration/i18n_fallbacks_spec.rb +0 -1
- data/spec/integration/matcher_examples_spec.rb +0 -1
- data/spec/integration/matcher_operator_spec.rb +27 -3
- data/spec/integration/matcher_spec.rb +95 -1
- data/spec/integration/server_query_spec.rb +0 -1
- data/spec/integration/shardable_spec.rb +0 -1
- data/spec/integration/stringified_symbol_field_spec.rb +14 -1
- data/spec/lite_spec_helper.rb +0 -1
- data/spec/mongoid/association/accessors_spec.rb +44 -15
- data/spec/mongoid/association/auto_save_spec.rb +72 -34
- data/spec/mongoid/association/builders_spec.rb +1 -2
- data/spec/mongoid/association/constrainable_spec.rb +0 -1
- data/spec/mongoid/association/counter_cache_spec.rb +32 -33
- data/spec/mongoid/association/depending_spec.rb +12 -13
- data/spec/mongoid/association/eager_spec.rb +4 -5
- data/spec/mongoid/association/embedded/cyclic_spec.rb +2 -3
- data/spec/mongoid/association/embedded/dirty_spec.rb +2 -3
- data/spec/mongoid/association/embedded/embedded_in/binding_spec.rb +0 -1
- data/spec/mongoid/association/embedded/embedded_in/buildable_spec.rb +0 -1
- data/spec/mongoid/association/embedded/embedded_in/proxy_spec.rb +13 -14
- data/spec/mongoid/association/embedded/embedded_in_spec.rb +0 -1
- data/spec/mongoid/association/embedded/embeds_many/binding_spec.rb +0 -1
- data/spec/mongoid/association/embedded/embeds_many/buildable_spec.rb +0 -1
- data/spec/mongoid/association/embedded/embeds_many/proxy_spec.rb +384 -156
- data/spec/mongoid/association/embedded/embeds_many_models.rb +0 -122
- data/spec/mongoid/association/embedded/embeds_many_query_spec.rb +0 -1
- data/spec/mongoid/association/embedded/embeds_many_spec.rb +0 -1
- data/spec/mongoid/association/embedded/embeds_one/binding_spec.rb +0 -1
- data/spec/mongoid/association/embedded/embeds_one/buildable_spec.rb +0 -1
- data/spec/mongoid/association/embedded/embeds_one/proxy_spec.rb +21 -22
- data/spec/mongoid/association/embedded/embeds_one_dnl_models.rb +0 -1
- data/spec/mongoid/association/embedded/embeds_one_models.rb +0 -1
- data/spec/mongoid/association/embedded/embeds_one_query_spec.rb +0 -1
- data/spec/mongoid/association/embedded/embeds_one_spec.rb +0 -1
- data/spec/mongoid/association/macros_spec.rb +9 -10
- data/spec/mongoid/association/nested/many_spec.rb +0 -1
- data/spec/mongoid/association/nested/one_spec.rb +0 -1
- data/spec/mongoid/association/options_spec.rb +0 -1
- data/spec/mongoid/association/polymorphic_spec.rb +0 -1
- data/spec/mongoid/association/referenced/belongs_to/binding_spec.rb +0 -1
- data/spec/mongoid/association/referenced/belongs_to/buildable_spec.rb +55 -17
- data/spec/mongoid/association/referenced/belongs_to/eager_spec.rb +50 -15
- data/spec/mongoid/association/referenced/belongs_to/proxy_spec.rb +57 -53
- data/spec/mongoid/association/referenced/belongs_to_query_spec.rb +0 -1
- data/spec/mongoid/association/referenced/belongs_to_spec.rb +22 -2
- data/spec/mongoid/association/referenced/has_and_belongs_to_many/binding_spec.rb +0 -1
- data/spec/mongoid/association/referenced/has_and_belongs_to_many/buildable_spec.rb +26 -2
- data/spec/mongoid/association/referenced/has_and_belongs_to_many/eager_spec.rb +31 -3
- data/spec/mongoid/association/referenced/has_and_belongs_to_many/proxy_persistence_spec.rb +0 -1
- data/spec/mongoid/association/referenced/has_and_belongs_to_many/proxy_spec.rb +179 -162
- data/spec/mongoid/association/referenced/has_and_belongs_to_many_models.rb +18 -1
- data/spec/mongoid/association/referenced/has_and_belongs_to_many_query_spec.rb +0 -1
- data/spec/mongoid/association/referenced/has_and_belongs_to_many_spec.rb +21 -1
- data/spec/mongoid/association/referenced/has_many/binding_spec.rb +0 -1
- data/spec/mongoid/association/referenced/has_many/buildable_spec.rb +21 -1
- data/spec/mongoid/association/referenced/has_many/eager_spec.rb +23 -7
- data/spec/mongoid/association/referenced/has_many/enumerable_spec.rb +59 -33
- data/spec/mongoid/association/referenced/has_many/proxy_query_spec.rb +0 -1
- data/spec/mongoid/association/referenced/has_many/proxy_spec.rb +225 -178
- data/spec/mongoid/association/referenced/has_many_models.rb +18 -1
- data/spec/mongoid/association/referenced/has_many_query_spec.rb +0 -1
- data/spec/mongoid/association/referenced/has_many_spec.rb +21 -1
- data/spec/mongoid/association/referenced/has_one/binding_spec.rb +0 -1
- data/spec/mongoid/association/referenced/has_one/buildable_spec.rb +51 -8
- data/spec/mongoid/association/referenced/has_one/eager_spec.rb +17 -2
- data/spec/mongoid/association/referenced/has_one/proxy_spec.rb +26 -27
- data/spec/mongoid/association/referenced/has_one_models.rb +18 -1
- data/spec/mongoid/association/referenced/has_one_query_spec.rb +0 -1
- data/spec/mongoid/association/referenced/has_one_spec.rb +21 -1
- data/spec/mongoid/association/reflections_spec.rb +0 -1
- data/spec/mongoid/association/syncable_spec.rb +31 -32
- data/spec/mongoid/association_spec.rb +0 -1
- data/spec/mongoid/atomic/modifiers_spec.rb +0 -1
- data/spec/mongoid/atomic/paths/embedded/many_spec.rb +0 -1
- data/spec/mongoid/atomic/paths/embedded/one_spec.rb +0 -1
- data/spec/mongoid/atomic/paths/root_spec.rb +0 -1
- data/spec/mongoid/atomic/paths_spec.rb +0 -1
- data/spec/mongoid/atomic_spec.rb +6 -7
- data/spec/mongoid/attributes/dynamic_spec.rb +0 -1
- data/spec/mongoid/attributes/nested_spec.rb +66 -67
- data/spec/mongoid/attributes/projector_spec.rb +5 -2
- data/spec/mongoid/attributes/readonly_spec.rb +22 -23
- data/spec/mongoid/attributes_spec.rb +32 -33
- data/spec/mongoid/cacheable_spec.rb +1 -2
- data/spec/mongoid/changeable_spec.rb +35 -36
- data/spec/mongoid/clients/factory_spec.rb +0 -1
- data/spec/mongoid/clients/options_spec.rb +4 -5
- data/spec/mongoid/clients/sessions_spec.rb +22 -23
- data/spec/mongoid/clients/transactions_spec.rb +49 -27
- data/spec/mongoid/clients_spec.rb +6 -7
- data/spec/mongoid/composable_spec.rb +0 -1
- data/spec/mongoid/config/environment_spec.rb +0 -1
- data/spec/mongoid/config/options_spec.rb +0 -1
- data/spec/mongoid/config_spec.rb +105 -1
- data/spec/mongoid/contextual/aggregable/memory_spec.rb +51 -12
- data/spec/mongoid/contextual/aggregable/mongo_spec.rb +120 -21
- data/spec/mongoid/contextual/aggregable/none_spec.rb +60 -0
- data/spec/mongoid/contextual/atomic_spec.rb +46 -47
- data/spec/mongoid/contextual/geo_near_spec.rb +17 -18
- data/spec/mongoid/contextual/map_reduce_spec.rb +2 -3
- data/spec/mongoid/contextual/memory_spec.rb +23 -24
- data/spec/mongoid/contextual/mongo_spec.rb +339 -77
- data/spec/mongoid/contextual/none_spec.rb +7 -82
- data/spec/mongoid/copyable_spec.rb +12 -13
- data/spec/mongoid/copyable_spec_models.rb +0 -1
- data/spec/mongoid/criteria/findable_spec.rb +23 -24
- data/spec/mongoid/criteria/inspectable_spec.rb +0 -1
- data/spec/mongoid/criteria/marshalable_spec.rb +0 -1
- data/spec/mongoid/criteria/modifiable_spec.rb +36 -37
- data/spec/mongoid/criteria/options_spec.rb +0 -1
- data/spec/mongoid/criteria/queryable/aggregable_spec.rb +1 -2
- data/spec/mongoid/criteria/queryable/expandable_spec.rb +0 -1
- data/spec/mongoid/criteria/queryable/extensions/array_spec.rb +0 -1
- data/spec/mongoid/criteria/queryable/extensions/big_decimal_spec.rb +0 -1
- data/spec/mongoid/criteria/queryable/extensions/bignum_spec.rb +0 -1
- data/spec/mongoid/criteria/queryable/extensions/boolean_spec.rb +0 -1
- data/spec/mongoid/criteria/queryable/extensions/date_spec.rb +0 -1
- data/spec/mongoid/criteria/queryable/extensions/date_time_spec.rb +0 -1
- data/spec/mongoid/criteria/queryable/extensions/fixnum_spec.rb +0 -1
- data/spec/mongoid/criteria/queryable/extensions/float_spec.rb +0 -1
- data/spec/mongoid/criteria/queryable/extensions/hash_spec.rb +0 -1
- data/spec/mongoid/criteria/queryable/extensions/integer_spec.rb +0 -1
- data/spec/mongoid/criteria/queryable/extensions/nil_class_spec.rb +0 -1
- data/spec/mongoid/criteria/queryable/extensions/numeric_spec.rb +0 -1
- data/spec/mongoid/criteria/queryable/extensions/object_spec.rb +0 -1
- data/spec/mongoid/criteria/queryable/extensions/range_spec.rb +237 -179
- data/spec/mongoid/criteria/queryable/extensions/regexp_raw_spec.rb +0 -1
- data/spec/mongoid/criteria/queryable/extensions/regexp_spec.rb +0 -1
- data/spec/mongoid/criteria/queryable/extensions/set_spec.rb +0 -1
- data/spec/mongoid/criteria/queryable/extensions/string_spec.rb +0 -1
- data/spec/mongoid/criteria/queryable/extensions/symbol_spec.rb +0 -1
- data/spec/mongoid/criteria/queryable/extensions/time_spec.rb +0 -1
- data/spec/mongoid/criteria/queryable/extensions/time_with_zone_spec.rb +0 -1
- data/spec/mongoid/criteria/queryable/key_spec.rb +0 -1
- data/spec/mongoid/criteria/queryable/mergeable_spec.rb +0 -1
- data/spec/mongoid/criteria/queryable/optional_spec.rb +1 -2
- data/spec/mongoid/criteria/queryable/options_spec.rb +0 -1
- data/spec/mongoid/criteria/queryable/pipeline_spec.rb +0 -1
- data/spec/mongoid/criteria/queryable/queryable_spec.rb +1 -2
- data/spec/mongoid/criteria/queryable/selectable_logical_spec.rb +0 -1
- data/spec/mongoid/criteria/queryable/selectable_shared_examples.rb +0 -1
- data/spec/mongoid/criteria/queryable/selectable_spec.rb +15 -16
- data/spec/mongoid/criteria/queryable/selectable_where_spec.rb +0 -1
- data/spec/mongoid/criteria/queryable/selector_spec.rb +0 -1
- data/spec/mongoid/criteria/queryable/smash_spec.rb +0 -1
- data/spec/mongoid/criteria/queryable/storable_spec.rb +37 -1
- data/spec/mongoid/criteria/scopable_spec.rb +127 -1
- data/spec/mongoid/criteria_projection_spec.rb +3 -4
- data/spec/mongoid/criteria_spec.rb +515 -187
- data/spec/mongoid/document_fields_spec.rb +0 -1
- data/spec/mongoid/document_persistence_context_spec.rb +0 -1
- data/spec/mongoid/document_query_spec.rb +0 -1
- data/spec/mongoid/document_spec.rb +11 -33
- data/spec/mongoid/equality_spec.rb +142 -41
- data/spec/mongoid/errors/ambiguous_relationship_spec.rb +0 -1
- data/spec/mongoid/errors/callback_spec.rb +0 -1
- data/spec/mongoid/errors/delete_restriction_spec.rb +0 -1
- data/spec/mongoid/errors/document_not_destroyed_spec.rb +0 -1
- data/spec/mongoid/errors/document_not_found_spec.rb +0 -1
- data/spec/mongoid/errors/eager_load_spec.rb +0 -1
- data/spec/mongoid/errors/invalid_collection_spec.rb +0 -1
- data/spec/mongoid/errors/invalid_config_file_spec.rb +0 -1
- data/spec/mongoid/errors/invalid_config_option_spec.rb +0 -1
- data/spec/mongoid/errors/invalid_field_option_spec.rb +0 -1
- data/spec/mongoid/errors/invalid_field_spec.rb +0 -1
- data/spec/mongoid/errors/invalid_find_spec.rb +0 -1
- data/spec/mongoid/errors/invalid_includes_spec.rb +0 -1
- data/spec/mongoid/errors/invalid_index_spec.rb +0 -1
- data/spec/mongoid/errors/invalid_options_spec.rb +0 -1
- data/spec/mongoid/errors/invalid_path_spec.rb +0 -1
- data/spec/mongoid/errors/invalid_relation_spec.rb +0 -1
- data/spec/mongoid/errors/invalid_scope_spec.rb +1 -2
- data/spec/mongoid/errors/invalid_set_polymorphic_relation_spec.rb +0 -1
- data/spec/mongoid/errors/invalid_storage_options_spec.rb +0 -1
- data/spec/mongoid/errors/invalid_time_spec.rb +0 -1
- data/spec/mongoid/errors/inverse_not_found_spec.rb +0 -1
- data/spec/mongoid/errors/mixed_client_configuration_spec.rb +0 -1
- data/spec/mongoid/errors/mixed_relations_spec.rb +0 -1
- data/spec/mongoid/errors/mongoid_error_spec.rb +0 -1
- data/spec/mongoid/errors/nested_attributes_metadata_not_found_spec.rb +0 -1
- data/spec/mongoid/errors/no_client_config_spec.rb +0 -1
- data/spec/mongoid/errors/no_client_database_spec.rb +0 -1
- data/spec/mongoid/errors/no_client_hosts_spec.rb +0 -1
- data/spec/mongoid/errors/no_clients_config_spec.rb +0 -1
- data/spec/mongoid/errors/no_environment_spec.rb +0 -1
- data/spec/mongoid/errors/no_map_reduce_output_spec.rb +0 -1
- data/spec/mongoid/errors/no_metadata_spec.rb +0 -1
- data/spec/mongoid/errors/no_parent_spec.rb +0 -1
- data/spec/mongoid/errors/readonly_attribute_spec.rb +0 -1
- data/spec/mongoid/errors/readonly_document_spec.rb +0 -1
- data/spec/mongoid/errors/scope_overwrite_spec.rb +0 -1
- data/spec/mongoid/errors/too_many_nested_attribute_records_spec.rb +0 -1
- data/spec/mongoid/errors/unknown_attribute_spec.rb +2 -3
- data/spec/mongoid/errors/unsaved_document_spec.rb +0 -1
- data/spec/mongoid/errors/unsupported_javascript_spec.rb +0 -1
- data/spec/mongoid/errors/validations_spec.rb +0 -1
- data/spec/mongoid/extensions/array_spec.rb +0 -1
- data/spec/mongoid/extensions/big_decimal_spec.rb +0 -1
- data/spec/mongoid/extensions/binary_spec.rb +0 -1
- data/spec/mongoid/extensions/boolean_spec.rb +0 -1
- data/spec/mongoid/extensions/date_class_mongoize_spec.rb +0 -1
- data/spec/mongoid/extensions/date_spec.rb +0 -1
- data/spec/mongoid/extensions/date_time_spec.rb +0 -1
- data/spec/mongoid/extensions/decimal128_spec.rb +0 -1
- data/spec/mongoid/extensions/false_class_spec.rb +0 -1
- data/spec/mongoid/extensions/float_spec.rb +0 -1
- data/spec/mongoid/extensions/hash_spec.rb +0 -1
- data/spec/mongoid/extensions/integer_spec.rb +0 -1
- data/spec/mongoid/extensions/module_spec.rb +0 -1
- data/spec/mongoid/extensions/nil_class_spec.rb +0 -1
- data/spec/mongoid/extensions/object_id_spec.rb +0 -1
- data/spec/mongoid/extensions/object_spec.rb +0 -1
- data/spec/mongoid/extensions/range_spec.rb +0 -1
- data/spec/mongoid/extensions/regexp_spec.rb +0 -1
- data/spec/mongoid/extensions/set_spec.rb +0 -1
- data/spec/mongoid/extensions/string_spec.rb +2 -3
- data/spec/mongoid/extensions/stringified_symbol_spec.rb +0 -1
- data/spec/mongoid/extensions/symbol_spec.rb +0 -1
- data/spec/mongoid/extensions/time_spec.rb +0 -1
- data/spec/mongoid/extensions/time_with_zone_spec.rb +0 -1
- data/spec/mongoid/extensions/true_class_spec.rb +0 -1
- data/spec/mongoid/extensions_spec.rb +14 -3
- data/spec/mongoid/factory_spec.rb +1 -1
- data/spec/mongoid/fields/foreign_key_spec.rb +0 -1
- data/spec/mongoid/fields/localized_spec.rb +0 -1
- data/spec/mongoid/fields/standard_spec.rb +0 -1
- data/spec/mongoid/fields_spec.rb +326 -31
- data/spec/mongoid/findable_spec.rb +21 -22
- data/spec/mongoid/indexable/specification_spec.rb +0 -1
- data/spec/mongoid/indexable_spec.rb +0 -1
- data/spec/mongoid/inspectable_spec.rb +0 -1
- data/spec/mongoid/interceptable_spec.rb +102 -95
- data/spec/mongoid/loggable_spec.rb +0 -1
- data/spec/mongoid/matcher/extract_attribute_spec.rb +5 -2
- data/spec/mongoid/persistable/creatable_spec.rb +2 -3
- data/spec/mongoid/persistable/deletable_spec.rb +18 -19
- data/spec/mongoid/persistable/destroyable_spec.rb +8 -9
- data/spec/mongoid/persistable/incrementable_spec.rb +8 -9
- data/spec/mongoid/persistable/logical_spec.rb +4 -5
- data/spec/mongoid/persistable/poppable_spec.rb +4 -5
- data/spec/mongoid/persistable/pullable_spec.rb +8 -9
- data/spec/mongoid/persistable/pushable_spec.rb +8 -9
- data/spec/mongoid/persistable/renamable_spec.rb +3 -4
- data/spec/mongoid/persistable/savable_spec.rb +15 -11
- data/spec/mongoid/persistable/settable_spec.rb +9 -10
- data/spec/mongoid/persistable/unsettable_spec.rb +4 -5
- data/spec/mongoid/persistable/updatable_spec.rb +41 -24
- data/spec/mongoid/persistable/upsertable_spec.rb +1 -2
- data/spec/mongoid/persistable_spec.rb +1 -2
- data/spec/mongoid/persistence_context_spec.rb +0 -1
- data/spec/mongoid/positional_spec.rb +0 -1
- data/spec/mongoid/query_cache_middleware_spec.rb +1 -2
- data/spec/mongoid/query_cache_spec.rb +30 -8
- data/spec/mongoid/relations/proxy_spec.rb +6 -7
- data/spec/mongoid/reloadable_spec.rb +209 -23
- data/spec/mongoid/scopable_spec.rb +54 -22
- data/spec/mongoid/selectable_spec.rb +6 -7
- data/spec/mongoid/serializable_spec.rb +9 -10
- data/spec/mongoid/shardable_spec.rb +2 -3
- data/spec/mongoid/stateful_spec.rb +1 -2
- data/spec/mongoid/tasks/database_rake_spec.rb +0 -1
- data/spec/mongoid/tasks/database_spec.rb +0 -1
- data/spec/mongoid/threaded_spec.rb +2 -3
- data/spec/mongoid/timestamps/created/short_spec.rb +1 -2
- data/spec/mongoid/timestamps/created_spec.rb +1 -2
- data/spec/mongoid/timestamps/timeless_spec.rb +2 -3
- data/spec/mongoid/timestamps/updated/short_spec.rb +3 -4
- data/spec/mongoid/timestamps/updated_spec.rb +3 -4
- data/spec/mongoid/timestamps_spec.rb +6 -7
- data/spec/mongoid/touchable_spec.rb +15 -20
- data/spec/mongoid/touchable_spec_models.rb +0 -1
- data/spec/mongoid/traversable_spec.rb +65 -2
- data/spec/mongoid/validatable/associated_spec.rb +0 -1
- data/spec/mongoid/validatable/format_spec.rb +0 -1
- data/spec/mongoid/validatable/length_spec.rb +0 -1
- data/spec/mongoid/validatable/numericality_spec.rb +0 -1
- data/spec/mongoid/validatable/presence_spec.rb +26 -23
- data/spec/mongoid/validatable/uniqueness_spec.rb +67 -68
- data/spec/mongoid/validatable_spec.rb +2 -3
- data/spec/mongoid_spec.rb +0 -1
- data/spec/rails/controller_extension/controller_runtime_spec.rb +0 -1
- data/spec/rails/mongoid_spec.rb +0 -1
- data/spec/shared/lib/mrss/constraints.rb +2 -1
- data/spec/shared/lib/mrss/docker_runner.rb +1 -1
- data/spec/shared/lib/mrss/lite_constraints.rb +8 -0
- data/spec/shared/share/Dockerfile.erb +25 -9
- data/spec/shared/shlib/distro.sh +2 -1
- data/spec/shared/shlib/server.sh +16 -4
- data/spec/shared/shlib/set_env.sh +6 -5
- data/spec/spec_helper.rb +12 -22
- data/spec/support/authorization.rb +0 -1
- data/spec/support/constraints.rb +0 -1
- data/spec/support/expectations.rb +0 -1
- data/spec/support/macros.rb +22 -1
- data/spec/support/models/account.rb +1 -2
- data/spec/support/models/acolyte.rb +0 -1
- data/spec/support/models/actor.rb +0 -1
- data/spec/support/models/actress.rb +0 -1
- data/spec/support/models/address.rb +0 -1
- data/spec/support/models/address_component.rb +0 -1
- data/spec/support/models/address_number.rb +0 -1
- data/spec/support/models/agency.rb +0 -1
- data/spec/support/models/agent.rb +0 -1
- data/spec/support/models/album.rb +0 -1
- data/spec/support/models/alert.rb +0 -1
- data/spec/support/models/animal.rb +0 -1
- data/spec/support/models/answer.rb +0 -1
- data/spec/support/models/appointment.rb +0 -1
- data/spec/support/models/armrest.rb +0 -1
- data/spec/support/models/array_field.rb +0 -1
- data/spec/support/models/article.rb +0 -1
- data/spec/support/models/artist.rb +2 -1
- data/spec/support/models/artwork.rb +0 -1
- data/spec/support/models/audio.rb +0 -1
- data/spec/support/models/augmentation.rb +0 -1
- data/spec/support/models/author.rb +0 -1
- data/spec/support/models/baby.rb +0 -1
- data/spec/support/models/band.rb +4 -1
- data/spec/support/models/bar.rb +0 -1
- data/spec/support/models/basic.rb +0 -1
- data/spec/support/models/bed.rb +0 -1
- data/spec/support/models/big_palette.rb +0 -1
- data/spec/support/models/birthday.rb +0 -1
- data/spec/support/models/bolt.rb +0 -1
- data/spec/support/models/bomb.rb +0 -1
- data/spec/support/models/book.rb +0 -1
- data/spec/support/models/breed.rb +0 -1
- data/spec/support/models/browser.rb +0 -1
- data/spec/support/models/building.rb +0 -1
- data/spec/support/models/building_address.rb +0 -1
- data/spec/support/models/bus.rb +0 -1
- data/spec/support/models/business.rb +0 -1
- data/spec/support/models/callback_test.rb +0 -1
- data/spec/support/models/canvas.rb +0 -1
- data/spec/support/models/car.rb +0 -1
- data/spec/support/models/cat.rb +0 -1
- data/spec/support/models/category.rb +0 -1
- data/spec/support/models/child.rb +0 -1
- data/spec/support/models/child_doc.rb +3 -4
- data/spec/support/models/church.rb +0 -1
- data/spec/support/models/circle.rb +0 -1
- data/spec/support/models/circuit.rb +0 -1
- data/spec/support/models/circus.rb +0 -1
- data/spec/support/models/code.rb +0 -1
- data/spec/support/models/coding/pull_request.rb +0 -1
- data/spec/support/models/coding.rb +0 -1
- data/spec/support/models/comment.rb +0 -1
- data/spec/support/models/company.rb +0 -1
- data/spec/support/models/consumption_period.rb +0 -1
- data/spec/support/models/contextable_item.rb +0 -1
- data/spec/support/models/contractor.rb +0 -1
- data/spec/support/models/cookie.rb +0 -1
- data/spec/support/models/country_code.rb +2 -1
- data/spec/support/models/courier_job.rb +0 -1
- data/spec/support/models/crate.rb +0 -1
- data/spec/support/models/customer.rb +0 -1
- data/spec/support/models/customer_address.rb +0 -1
- data/spec/support/models/deed.rb +0 -1
- data/spec/support/models/definition.rb +0 -1
- data/spec/support/models/delegating_patient.rb +0 -1
- data/spec/support/models/description.rb +0 -1
- data/spec/support/models/dictionary.rb +0 -1
- data/spec/support/models/division.rb +0 -1
- data/spec/support/models/doctor.rb +0 -1
- data/spec/support/models/dog.rb +0 -1
- data/spec/support/models/dokument.rb +0 -1
- data/spec/support/models/draft.rb +0 -1
- data/spec/support/models/dragon.rb +0 -1
- data/spec/support/models/driver.rb +0 -1
- data/spec/support/models/drug.rb +0 -1
- data/spec/support/models/dungeon.rb +0 -1
- data/spec/support/models/edit.rb +0 -1
- data/spec/support/models/email.rb +0 -1
- data/spec/support/models/employer.rb +0 -1
- data/spec/support/models/entry.rb +0 -1
- data/spec/support/models/eraser.rb +0 -1
- data/spec/support/models/even.rb +0 -1
- data/spec/support/models/event.rb +0 -1
- data/spec/support/models/exhibition.rb +0 -1
- data/spec/support/models/exhibitor.rb +0 -1
- data/spec/support/models/explosion.rb +0 -1
- data/spec/support/models/eye.rb +0 -1
- data/spec/support/models/eye_bowl.rb +0 -1
- data/spec/support/models/face.rb +0 -1
- data/spec/support/models/favorite.rb +0 -1
- data/spec/support/models/filesystem.rb +0 -1
- data/spec/support/models/fire_hydrant.rb +0 -1
- data/spec/support/models/firefox.rb +0 -1
- data/spec/support/models/fish.rb +0 -1
- data/spec/support/models/folder.rb +0 -1
- data/spec/support/models/folder_item.rb +0 -1
- data/spec/support/models/fruits.rb +0 -1
- data/spec/support/models/game.rb +0 -1
- data/spec/support/models/ghost.rb +0 -1
- data/spec/support/models/guitar.rb +0 -1
- data/spec/support/models/hole.rb +0 -1
- data/spec/support/models/home.rb +0 -1
- data/spec/support/models/house.rb +0 -1
- data/spec/support/models/html_writer.rb +0 -1
- data/spec/support/models/id_key.rb +0 -1
- data/spec/support/models/idnodef.rb +0 -1
- data/spec/support/models/image.rb +0 -1
- data/spec/support/models/implant.rb +0 -1
- data/spec/support/models/instrument.rb +0 -1
- data/spec/support/models/item.rb +0 -1
- data/spec/support/models/jar.rb +0 -1
- data/spec/support/models/kaleidoscope.rb +0 -1
- data/spec/support/models/kangaroo.rb +0 -1
- data/spec/support/models/label.rb +2 -2
- data/spec/support/models/language.rb +0 -1
- data/spec/support/models/lat_lng.rb +0 -1
- data/spec/support/models/league.rb +0 -1
- data/spec/support/models/learner.rb +0 -1
- data/spec/support/models/line_item.rb +0 -1
- data/spec/support/models/location.rb +0 -1
- data/spec/support/models/login.rb +0 -1
- data/spec/support/models/manufacturer.rb +0 -1
- data/spec/support/models/meat.rb +0 -1
- data/spec/support/models/membership.rb +0 -1
- data/spec/support/models/message.rb +0 -1
- data/spec/support/models/minim.rb +0 -1
- data/spec/support/models/mixed_drink.rb +0 -1
- data/spec/support/models/mop.rb +0 -1
- data/spec/support/models/movie.rb +0 -1
- data/spec/support/models/my_hash.rb +0 -1
- data/spec/support/models/name.rb +0 -1
- data/spec/support/models/name_only.rb +0 -1
- data/spec/support/models/node.rb +0 -1
- data/spec/support/models/note.rb +0 -1
- data/spec/support/models/nut.rb +0 -1
- data/spec/support/models/odd.rb +0 -1
- data/spec/support/models/order.rb +2 -1
- data/spec/support/models/ordered_post.rb +1 -2
- data/spec/support/models/ordered_preference.rb +0 -1
- data/spec/support/models/oscar.rb +0 -1
- data/spec/support/models/other_owner_object.rb +0 -1
- data/spec/support/models/override.rb +0 -1
- data/spec/support/models/ownable.rb +0 -1
- data/spec/support/models/owner.rb +0 -1
- data/spec/support/models/pack.rb +0 -1
- data/spec/support/models/page.rb +0 -1
- data/spec/support/models/page_question.rb +0 -1
- data/spec/support/models/palette.rb +0 -1
- data/spec/support/models/parent.rb +0 -1
- data/spec/support/models/parent_doc.rb +0 -1
- data/spec/support/models/passport.rb +5 -1
- data/spec/support/models/patient.rb +0 -1
- data/spec/support/models/pdf_writer.rb +0 -1
- data/spec/support/models/pencil.rb +0 -1
- data/spec/support/models/person.rb +1 -1
- data/spec/support/models/pet.rb +0 -1
- data/spec/support/models/pet_owner.rb +0 -1
- data/spec/support/models/phone.rb +2 -2
- data/spec/support/models/piano.rb +0 -1
- data/spec/support/models/pizza.rb +0 -1
- data/spec/support/models/player.rb +0 -1
- data/spec/support/models/post.rb +0 -1
- data/spec/support/models/post_genre.rb +0 -1
- data/spec/support/models/powerup.rb +0 -1
- data/spec/support/models/preference.rb +0 -1
- data/spec/support/models/princess.rb +0 -1
- data/spec/support/models/product.rb +0 -1
- data/spec/support/models/profile.rb +0 -1
- data/spec/support/models/pronunciation.rb +0 -1
- data/spec/support/models/pub.rb +0 -1
- data/spec/support/models/publication/encyclopedia.rb +0 -1
- data/spec/support/models/publication/review.rb +0 -1
- data/spec/support/models/publication.rb +0 -1
- data/spec/support/models/purchase.rb +0 -1
- data/spec/support/models/purchased_item.rb +10 -0
- data/spec/support/models/question.rb +0 -1
- data/spec/support/models/quiz.rb +0 -1
- data/spec/support/models/rating.rb +0 -1
- data/spec/support/models/record.rb +0 -1
- data/spec/support/models/registry.rb +0 -1
- data/spec/support/models/role.rb +0 -1
- data/spec/support/models/root_category.rb +0 -1
- data/spec/support/models/sandwich.rb +0 -1
- data/spec/support/models/scheduler.rb +0 -1
- data/spec/support/models/scribe.rb +0 -1
- data/spec/support/models/sealer.rb +0 -1
- data/spec/support/models/seat.rb +0 -1
- data/spec/support/models/seo.rb +0 -1
- data/spec/support/models/series.rb +0 -1
- data/spec/support/models/server.rb +0 -1
- data/spec/support/models/service.rb +0 -1
- data/spec/support/models/shape.rb +0 -1
- data/spec/support/models/shelf.rb +0 -1
- data/spec/support/models/shipment_address.rb +0 -1
- data/spec/support/models/shipping_container.rb +0 -1
- data/spec/support/models/shipping_pack.rb +0 -1
- data/spec/support/models/shirt.rb +0 -1
- data/spec/support/models/shop.rb +0 -1
- data/spec/support/models/short_agent.rb +0 -1
- data/spec/support/models/short_quiz.rb +0 -1
- data/spec/support/models/simple.rb +0 -1
- data/spec/support/models/slave.rb +0 -1
- data/spec/support/models/song.rb +0 -1
- data/spec/support/models/sound.rb +0 -1
- data/spec/support/models/spacer.rb +0 -1
- data/spec/support/models/square.rb +0 -1
- data/spec/support/models/staff.rb +0 -1
- data/spec/support/models/store_as_dup_test1.rb +0 -1
- data/spec/support/models/store_as_dup_test2.rb +0 -1
- data/spec/support/models/store_as_dup_test3.rb +0 -1
- data/spec/support/models/store_as_dup_test4.rb +0 -1
- data/spec/support/models/strategy.rb +0 -1
- data/spec/support/models/sub_item.rb +0 -1
- data/spec/support/models/subscription.rb +0 -1
- data/spec/support/models/survey.rb +0 -1
- data/spec/support/models/symptom.rb +0 -1
- data/spec/support/models/tag.rb +0 -1
- data/spec/support/models/target.rb +0 -1
- data/spec/support/models/template.rb +0 -1
- data/spec/support/models/thing.rb +0 -1
- data/spec/support/models/threadlocker.rb +0 -1
- data/spec/support/models/title.rb +0 -1
- data/spec/support/models/tool.rb +0 -1
- data/spec/support/models/topping.rb +0 -1
- data/spec/support/models/toy.rb +0 -1
- data/spec/support/models/track.rb +0 -1
- data/spec/support/models/translation.rb +0 -1
- data/spec/support/models/tree.rb +0 -1
- data/spec/support/models/truck.rb +0 -1
- data/spec/support/models/updatable.rb +0 -1
- data/spec/support/models/user.rb +0 -1
- data/spec/support/models/user_account.rb +0 -1
- data/spec/support/models/validation_callback.rb +0 -1
- data/spec/support/models/vehicle.rb +0 -1
- data/spec/support/models/version.rb +0 -1
- data/spec/support/models/vertex.rb +0 -1
- data/spec/support/models/vet_visit.rb +0 -1
- data/spec/support/models/video.rb +0 -1
- data/spec/support/models/video_game.rb +0 -1
- data/spec/support/models/washer.rb +0 -1
- data/spec/support/models/weapon.rb +0 -1
- data/spec/support/models/wiki_page.rb +0 -1
- data/spec/support/models/word.rb +0 -1
- data/spec/support/models/word_origin.rb +0 -1
- data/spec/support/models/writer.rb +0 -1
- data/spec/support/shared/time.rb +0 -1
- data/spec/support/spec_config.rb +3 -1
- data.tar.gz.sig +0 -0
- metadata +25 -12
- metadata.gz.sig +0 -0
- data/lib/support/ruby_version.rb +0 -29
@@ -1,8 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
# encoding: utf-8
|
3
2
|
|
4
3
|
require "spec_helper"
|
5
|
-
require_relative '../embeds_many_models.rb'
|
6
4
|
|
7
5
|
describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
8
6
|
|
@@ -116,7 +114,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
116
114
|
context "when the parent is not a new record" do
|
117
115
|
|
118
116
|
let(:person) do
|
119
|
-
Person.create
|
117
|
+
Person.create!
|
120
118
|
end
|
121
119
|
|
122
120
|
let(:address) do
|
@@ -135,7 +133,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
135
133
|
context "when appending more than one document at once" do
|
136
134
|
|
137
135
|
let(:person) do
|
138
|
-
Person.create
|
136
|
+
Person.create!
|
139
137
|
end
|
140
138
|
|
141
139
|
let(:address_one) do
|
@@ -211,7 +209,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
211
209
|
context "when the parent is not a new record" do
|
212
210
|
|
213
211
|
let(:parent_role) do
|
214
|
-
Role.create(name: "CEO")
|
212
|
+
Role.create!(name: "CEO")
|
215
213
|
end
|
216
214
|
|
217
215
|
let(:child_role) do
|
@@ -230,7 +228,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
230
228
|
|
231
229
|
context "when the child has one sided many to many relation" do
|
232
230
|
let(:person) do
|
233
|
-
Person.create
|
231
|
+
Person.create!
|
234
232
|
end
|
235
233
|
|
236
234
|
let(:message) do
|
@@ -313,7 +311,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
313
311
|
context "when the parent is not a new record" do
|
314
312
|
|
315
313
|
let(:person) do
|
316
|
-
Person.create
|
314
|
+
Person.create!
|
317
315
|
end
|
318
316
|
|
319
317
|
let(:address) do
|
@@ -334,11 +332,11 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
334
332
|
context "when setting via an overridden method from the parent" do
|
335
333
|
|
336
334
|
let!(:person) do
|
337
|
-
Person.create
|
335
|
+
Person.create!
|
338
336
|
end
|
339
337
|
|
340
338
|
let!(:address) do
|
341
|
-
person.addresses.create(street: "Alt Treptow")
|
339
|
+
person.addresses.create!(street: "Alt Treptow")
|
342
340
|
end
|
343
341
|
|
344
342
|
let!(:new_address) do
|
@@ -346,7 +344,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
346
344
|
end
|
347
345
|
|
348
346
|
before do
|
349
|
-
person.update_attributes(set_addresses: [ new_address ])
|
347
|
+
person.update_attributes!(set_addresses: [ new_address ])
|
350
348
|
end
|
351
349
|
|
352
350
|
it "overwrites the existing addresses" do
|
@@ -376,7 +374,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
376
374
|
|
377
375
|
before do
|
378
376
|
person.addresses = [ address_two ]
|
379
|
-
person.save
|
377
|
+
person.save!
|
380
378
|
end
|
381
379
|
|
382
380
|
it "sets the new documents" do
|
@@ -410,7 +408,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
410
408
|
|
411
409
|
before do
|
412
410
|
doctor.addresses = [ address_one ]
|
413
|
-
doctor.save
|
411
|
+
doctor.save!
|
414
412
|
end
|
415
413
|
|
416
414
|
it "sets the documents" do
|
@@ -429,7 +427,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
429
427
|
|
430
428
|
before do
|
431
429
|
doctor.addresses = [ address_two ]
|
432
|
-
doctor.save
|
430
|
+
doctor.save!
|
433
431
|
end
|
434
432
|
|
435
433
|
it "sets the new documents" do
|
@@ -447,7 +445,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
447
445
|
context "when replacing an existing relation" do
|
448
446
|
|
449
447
|
let(:person) do
|
450
|
-
Person.create(addresses: addresses)
|
448
|
+
Person.create!(addresses: addresses)
|
451
449
|
end
|
452
450
|
|
453
451
|
let(:addresses) do
|
@@ -508,7 +506,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
508
506
|
end
|
509
507
|
|
510
508
|
let(:tracking_id) do
|
511
|
-
MyCompany::Model::TrackingId.create
|
509
|
+
MyCompany::Model::TrackingId.create!
|
512
510
|
end
|
513
511
|
|
514
512
|
let(:history) do
|
@@ -543,7 +541,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
543
541
|
inflect.singular("address_numbers", "address_number")
|
544
542
|
end
|
545
543
|
slave.address_numbers << AddressNumber.new(country_code: 1)
|
546
|
-
slave.save
|
544
|
+
slave.save!
|
547
545
|
end
|
548
546
|
|
549
547
|
it "requires an inflection to determine the class" do
|
@@ -554,15 +552,15 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
554
552
|
context "when setting the entire tree via a hash" do
|
555
553
|
|
556
554
|
let(:person) do
|
557
|
-
Person.create
|
555
|
+
Person.create!
|
558
556
|
end
|
559
557
|
|
560
558
|
let!(:address_one) do
|
561
|
-
person.addresses.create(street: "Tauentzienstr")
|
559
|
+
person.addresses.create!(street: "Tauentzienstr")
|
562
560
|
end
|
563
561
|
|
564
562
|
let!(:address_two) do
|
565
|
-
person.addresses.create(street: "Kudamm")
|
563
|
+
person.addresses.create!(street: "Kudamm")
|
566
564
|
end
|
567
565
|
|
568
566
|
let(:attributes) do
|
@@ -573,7 +571,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
573
571
|
|
574
572
|
before do
|
575
573
|
attributes["addresses"][0]["city"] = "Berlin"
|
576
|
-
person.update_attributes(attributes)
|
574
|
+
person.update_attributes!(attributes)
|
577
575
|
end
|
578
576
|
|
579
577
|
it "sets the new attributes" do
|
@@ -589,15 +587,15 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
589
587
|
context "when setting an embedded sub-document tree via a hash" do
|
590
588
|
|
591
589
|
let(:person) do
|
592
|
-
Person.create
|
590
|
+
Person.create!
|
593
591
|
end
|
594
592
|
|
595
593
|
let!(:address_one) do
|
596
|
-
person.addresses.create(street: "Tauentzienstr")
|
594
|
+
person.addresses.create!(street: "Tauentzienstr")
|
597
595
|
end
|
598
596
|
|
599
597
|
let!(:location_one) do
|
600
|
-
person.addresses.first.locations.create(name: "Work")
|
598
|
+
person.addresses.first.locations.create!(name: "Work")
|
601
599
|
end
|
602
600
|
|
603
601
|
let(:attributes) do
|
@@ -609,7 +607,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
609
607
|
before do
|
610
608
|
attributes["city"] = "Berlin"
|
611
609
|
attributes["locations"][0]["name"] = "Home"
|
612
|
-
person.addresses.first.update_attributes(attributes)
|
610
|
+
person.addresses.first.update_attributes!(attributes)
|
613
611
|
end
|
614
612
|
|
615
613
|
it "sets the new attributes on the address" do
|
@@ -682,7 +680,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
682
680
|
context "when the parent is not a new record" do
|
683
681
|
|
684
682
|
let(:parent_role) do
|
685
|
-
Role.create(name: "CTO")
|
683
|
+
Role.create!(name: "CTO")
|
686
684
|
end
|
687
685
|
|
688
686
|
let(:child_role) do
|
@@ -750,7 +748,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
750
748
|
context "when the parent is persisted" do
|
751
749
|
|
752
750
|
let(:person) do
|
753
|
-
Person.create
|
751
|
+
Person.create!
|
754
752
|
end
|
755
753
|
|
756
754
|
let(:address) do
|
@@ -799,7 +797,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
799
797
|
context "when saving the parent" do
|
800
798
|
|
801
799
|
before do
|
802
|
-
person.save
|
800
|
+
person.save!
|
803
801
|
person.reload
|
804
802
|
end
|
805
803
|
|
@@ -813,7 +811,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
813
811
|
context "when setting on a reload" do
|
814
812
|
|
815
813
|
let(:person) do
|
816
|
-
Person.create
|
814
|
+
Person.create!
|
817
815
|
end
|
818
816
|
|
819
817
|
let(:address) do
|
@@ -883,7 +881,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
883
881
|
context "when the documents are not new records" do
|
884
882
|
|
885
883
|
let(:parent_role) do
|
886
|
-
Role.create
|
884
|
+
Role.create!
|
887
885
|
end
|
888
886
|
|
889
887
|
let(:child_role) do
|
@@ -913,13 +911,13 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
913
911
|
describe "#as_document" do
|
914
912
|
|
915
913
|
let!(:person) do
|
916
|
-
Person.create
|
914
|
+
Person.create!
|
917
915
|
end
|
918
916
|
|
919
917
|
context 'when a string is used to access an attribute' do
|
920
918
|
|
921
919
|
let!(:address) do
|
922
|
-
person.addresses.create(street: "one")
|
920
|
+
person.addresses.create!(street: "one")
|
923
921
|
end
|
924
922
|
|
925
923
|
let(:document) do
|
@@ -934,7 +932,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
934
932
|
context 'when a symbol is used to access an attribute' do
|
935
933
|
|
936
934
|
let!(:address) do
|
937
|
-
person.addresses.create(street: "one")
|
935
|
+
person.addresses.create!(street: "one")
|
938
936
|
end
|
939
937
|
|
940
938
|
let(:document) do
|
@@ -949,7 +947,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
949
947
|
context "when the relation has no default scope" do
|
950
948
|
|
951
949
|
let!(:address) do
|
952
|
-
person.addresses.create(street: "one")
|
950
|
+
person.addresses.create!(street: "one")
|
953
951
|
end
|
954
952
|
|
955
953
|
let(:document) do
|
@@ -1106,7 +1104,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
1106
1104
|
context "when providing nested attributes" do
|
1107
1105
|
|
1108
1106
|
let(:person) do
|
1109
|
-
Person.create
|
1107
|
+
Person.create!
|
1110
1108
|
end
|
1111
1109
|
|
1112
1110
|
let(:address) do
|
@@ -1120,7 +1118,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
1120
1118
|
context "when followed by a save" do
|
1121
1119
|
|
1122
1120
|
before do
|
1123
|
-
address.save
|
1121
|
+
address.save!
|
1124
1122
|
end
|
1125
1123
|
|
1126
1124
|
let(:location) do
|
@@ -1140,13 +1138,13 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
1140
1138
|
context "when the parent has been persisted" do
|
1141
1139
|
|
1142
1140
|
let(:person) do
|
1143
|
-
Person.create
|
1141
|
+
Person.create!
|
1144
1142
|
end
|
1145
1143
|
|
1146
1144
|
context "when the children are persisted" do
|
1147
1145
|
|
1148
1146
|
let!(:address) do
|
1149
|
-
person.addresses.create(street: "High St")
|
1147
|
+
person.addresses.create!(street: "High St")
|
1150
1148
|
end
|
1151
1149
|
|
1152
1150
|
let!(:relation) do
|
@@ -1262,7 +1260,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
1262
1260
|
context "when the parent is not a new record" do
|
1263
1261
|
|
1264
1262
|
let(:person) do
|
1265
|
-
Person.create
|
1263
|
+
Person.create!
|
1266
1264
|
end
|
1267
1265
|
|
1268
1266
|
let(:address) do
|
@@ -1281,7 +1279,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
1281
1279
|
context "when concatenating an empty array" do
|
1282
1280
|
|
1283
1281
|
let(:person) do
|
1284
|
-
Person.create
|
1282
|
+
Person.create!
|
1285
1283
|
end
|
1286
1284
|
|
1287
1285
|
before do
|
@@ -1297,7 +1295,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
1297
1295
|
context "when appending more than one document at once" do
|
1298
1296
|
|
1299
1297
|
let(:person) do
|
1300
|
-
Person.create
|
1298
|
+
Person.create!
|
1301
1299
|
end
|
1302
1300
|
|
1303
1301
|
let(:address_one) do
|
@@ -1369,7 +1367,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
1369
1367
|
context "when the parent is not a new record" do
|
1370
1368
|
|
1371
1369
|
let(:parent_role) do
|
1372
|
-
Role.create(name: "CEO")
|
1370
|
+
Role.create!(name: "CEO")
|
1373
1371
|
end
|
1374
1372
|
|
1375
1373
|
let(:child_role) do
|
@@ -1390,49 +1388,261 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
1390
1388
|
describe "#count" do
|
1391
1389
|
|
1392
1390
|
let(:person) do
|
1393
|
-
Person.create
|
1391
|
+
Person.create!
|
1394
1392
|
end
|
1395
1393
|
|
1396
1394
|
before do
|
1397
|
-
person.addresses.create(street: "Upper")
|
1395
|
+
person.addresses.create!(street: "Upper")
|
1398
1396
|
person.addresses.build(street: "Bond")
|
1397
|
+
person.addresses.build(street: "Lower")
|
1399
1398
|
end
|
1400
1399
|
|
1401
1400
|
it "returns the number of persisted documents" do
|
1402
1401
|
expect(person.addresses.count).to eq(1)
|
1403
1402
|
end
|
1403
|
+
|
1404
|
+
context 'block form' do
|
1405
|
+
it "iterates across all documents" do
|
1406
|
+
expect(person.addresses.count {|a| a.persisted? }).to eq(1)
|
1407
|
+
expect(person.addresses.count {|a| !a.persisted? }).to eq(2)
|
1408
|
+
expect(person.addresses.count {|a| a.street.include?('on') }).to eq(1)
|
1409
|
+
expect(person.addresses.count {|a| a.street.ends_with?('er') }).to eq(2)
|
1410
|
+
end
|
1411
|
+
end
|
1412
|
+
|
1413
|
+
context 'argument form' do
|
1414
|
+
it "behaves correctly when given a model instance" do
|
1415
|
+
expect(person.addresses.count(person.addresses.first)).to eq(1)
|
1416
|
+
end
|
1417
|
+
|
1418
|
+
it "behaves correctly when given a non-model instance" do
|
1419
|
+
expect(person.addresses.count(1)).to eq(0)
|
1420
|
+
end
|
1421
|
+
end
|
1404
1422
|
end
|
1405
1423
|
|
1406
1424
|
describe "#any?" do
|
1407
1425
|
|
1408
1426
|
let(:person) do
|
1409
|
-
Person.create
|
1427
|
+
Person.create!
|
1410
1428
|
end
|
1411
1429
|
|
1412
1430
|
context "when documents are persisted" do
|
1413
1431
|
before do
|
1414
|
-
person.addresses.create(street: "Upper")
|
1432
|
+
person.addresses.create!(street: "Upper")
|
1415
1433
|
end
|
1416
1434
|
|
1417
1435
|
it "returns true" do
|
1418
1436
|
expect(person.addresses.any?).to be true
|
1419
1437
|
end
|
1438
|
+
|
1439
|
+
it "block form iterates across all documents" do
|
1440
|
+
expect(person.addresses.any? {|a| a.street == "Upper" }).to be true
|
1441
|
+
expect(person.addresses.any? {|a| a.street == "Bond" }).to be false
|
1442
|
+
end
|
1443
|
+
|
1444
|
+
context 'argument form' do
|
1445
|
+
it "behaves correctly when given a model instance" do
|
1446
|
+
expect(person.addresses.any?(person.addresses.first)).to be true
|
1447
|
+
end
|
1448
|
+
|
1449
|
+
it "behaves correctly when given a non-model instance" do
|
1450
|
+
expect(person.addresses.any?(1)).to be false
|
1451
|
+
end
|
1452
|
+
end
|
1420
1453
|
end
|
1421
|
-
|
1454
|
+
|
1422
1455
|
context "when documents are not persisted" do
|
1423
1456
|
before do
|
1424
1457
|
person.addresses.build(street: "Bond")
|
1425
1458
|
end
|
1426
|
-
|
1459
|
+
|
1427
1460
|
it "returns true" do
|
1428
1461
|
expect(person.addresses.any?).to be true
|
1429
1462
|
end
|
1463
|
+
|
1464
|
+
it "block form iterates across all documents" do
|
1465
|
+
expect(person.addresses.any? {|a| a.street == "Upper" }).to be false
|
1466
|
+
expect(person.addresses.any? {|a| a.street == "Bond" }).to be true
|
1467
|
+
end
|
1468
|
+
|
1469
|
+
context 'argument form' do
|
1470
|
+
it "behaves correctly when given a model instance" do
|
1471
|
+
expect(person.addresses.any?(person.addresses.first)).to be true
|
1472
|
+
end
|
1473
|
+
|
1474
|
+
it "behaves correctly when given a non-model instance" do
|
1475
|
+
expect(person.addresses.any?(1)).to be false
|
1476
|
+
end
|
1477
|
+
end
|
1430
1478
|
end
|
1431
1479
|
|
1432
|
-
context "when documents are not
|
1480
|
+
context "when documents are not present" do
|
1433
1481
|
it "returns false" do
|
1434
1482
|
expect(person.addresses.any?).to be false
|
1435
1483
|
end
|
1484
|
+
|
1485
|
+
it "block form iterates across all documents" do
|
1486
|
+
expect(person.addresses.any?(&:a)).to be false
|
1487
|
+
end
|
1488
|
+
|
1489
|
+
it "argument form is supported" do
|
1490
|
+
expect(person.addresses.any?(1)).to be false
|
1491
|
+
end
|
1492
|
+
end
|
1493
|
+
end
|
1494
|
+
|
1495
|
+
describe "#all?" do
|
1496
|
+
|
1497
|
+
let(:person) do
|
1498
|
+
Person.create!
|
1499
|
+
end
|
1500
|
+
|
1501
|
+
context "when documents are persisted" do
|
1502
|
+
before do
|
1503
|
+
person.addresses.create!(street: "Upper")
|
1504
|
+
end
|
1505
|
+
|
1506
|
+
it "returns true" do
|
1507
|
+
expect(person.addresses.all?).to be true
|
1508
|
+
end
|
1509
|
+
|
1510
|
+
it "block form iterates across all documents" do
|
1511
|
+
expect(person.addresses.all? {|a| a.street == "Upper" }).to be true
|
1512
|
+
expect(person.addresses.all? {|a| a.street == "Bond" }).to be false
|
1513
|
+
end
|
1514
|
+
|
1515
|
+
context 'argument form' do
|
1516
|
+
it "behaves correctly when given a model instance" do
|
1517
|
+
expect(person.addresses.all?(person.addresses.first)).to be true
|
1518
|
+
end
|
1519
|
+
|
1520
|
+
it "behaves correctly when given a non-model instance" do
|
1521
|
+
expect(person.addresses.all?(1)).to be false
|
1522
|
+
end
|
1523
|
+
end
|
1524
|
+
end
|
1525
|
+
|
1526
|
+
context "when documents are not persisted" do
|
1527
|
+
before do
|
1528
|
+
person.addresses.build(street: "Bond")
|
1529
|
+
end
|
1530
|
+
|
1531
|
+
it "returns true" do
|
1532
|
+
expect(person.addresses.all?).to be true
|
1533
|
+
end
|
1534
|
+
|
1535
|
+
it "block form iterates across all documents" do
|
1536
|
+
expect(person.addresses.all? {|a| a.street == "Upper" }).to be false
|
1537
|
+
expect(person.addresses.all? {|a| a.street == "Bond" }).to be true
|
1538
|
+
end
|
1539
|
+
|
1540
|
+
context 'argument form' do
|
1541
|
+
it "behaves correctly when given a model instance" do
|
1542
|
+
expect(person.addresses.all?(person.addresses.first)).to be true
|
1543
|
+
end
|
1544
|
+
|
1545
|
+
it "behaves correctly when given a non-model instance" do
|
1546
|
+
expect(person.addresses.all?(1)).to be false
|
1547
|
+
end
|
1548
|
+
end
|
1549
|
+
end
|
1550
|
+
|
1551
|
+
context "when documents are not present" do
|
1552
|
+
it "returns false" do
|
1553
|
+
expect(person.addresses.all?).to be true
|
1554
|
+
end
|
1555
|
+
|
1556
|
+
it "block form iterates across all documents" do
|
1557
|
+
expect(person.addresses.all?(&:foo)).to be true
|
1558
|
+
end
|
1559
|
+
|
1560
|
+
context 'argument form' do
|
1561
|
+
it "behaves correctly when given nil" do
|
1562
|
+
expect(person.addresses.all?(nil)).to be true
|
1563
|
+
end
|
1564
|
+
|
1565
|
+
it "behaves correctly when given a non-model instance" do
|
1566
|
+
expect(person.addresses.all?(1)).to be true
|
1567
|
+
end
|
1568
|
+
end
|
1569
|
+
end
|
1570
|
+
end
|
1571
|
+
|
1572
|
+
describe "#none?" do
|
1573
|
+
|
1574
|
+
let(:person) do
|
1575
|
+
Person.create!
|
1576
|
+
end
|
1577
|
+
|
1578
|
+
context "when documents are persisted" do
|
1579
|
+
before do
|
1580
|
+
person.addresses.create!(street: "Upper")
|
1581
|
+
end
|
1582
|
+
|
1583
|
+
it "returns true" do
|
1584
|
+
expect(person.addresses.none?).to be false
|
1585
|
+
end
|
1586
|
+
|
1587
|
+
it "block form iterates across all documents" do
|
1588
|
+
expect(person.addresses.none? {|a| a.street == "Upper" }).to be false
|
1589
|
+
expect(person.addresses.none? {|a| a.street == "Bond" }).to be true
|
1590
|
+
end
|
1591
|
+
|
1592
|
+
context 'argument form' do
|
1593
|
+
it "behaves correctly when given a model instance" do
|
1594
|
+
expect(person.addresses.none?(person.addresses.first)).to be false
|
1595
|
+
end
|
1596
|
+
|
1597
|
+
it "behaves correctly when given a non-model instance" do
|
1598
|
+
expect(person.addresses.none?(1)).to be true
|
1599
|
+
end
|
1600
|
+
end
|
1601
|
+
end
|
1602
|
+
|
1603
|
+
context "when documents are not persisted" do
|
1604
|
+
before do
|
1605
|
+
person.addresses.build(street: "Bond")
|
1606
|
+
end
|
1607
|
+
|
1608
|
+
it "returns true" do
|
1609
|
+
expect(person.addresses.none?).to be false
|
1610
|
+
end
|
1611
|
+
|
1612
|
+
it "block form iterates across all documents" do
|
1613
|
+
expect(person.addresses.none? {|a| a.street == "Upper" }).to be true
|
1614
|
+
expect(person.addresses.none? {|a| a.street == "Bond" }).to be false
|
1615
|
+
end
|
1616
|
+
|
1617
|
+
context 'argument form' do
|
1618
|
+
it "behaves correctly when given a model instance" do
|
1619
|
+
expect(person.addresses.none?(person.addresses.first)).to be false
|
1620
|
+
end
|
1621
|
+
|
1622
|
+
it "behaves correctly when given a non-model instance" do
|
1623
|
+
expect(person.addresses.none?(1)).to be true
|
1624
|
+
end
|
1625
|
+
end
|
1626
|
+
end
|
1627
|
+
|
1628
|
+
context "when documents are not present" do
|
1629
|
+
it "returns false" do
|
1630
|
+
expect(person.addresses.none?).to be true
|
1631
|
+
end
|
1632
|
+
|
1633
|
+
it "block form iterates across all documents" do
|
1634
|
+
expect(person.addresses.none?(&:a)).to be true
|
1635
|
+
end
|
1636
|
+
|
1637
|
+
context 'argument form' do
|
1638
|
+
it "behaves correctly when given nil" do
|
1639
|
+
expect(person.addresses.none?(nil)).to be true
|
1640
|
+
end
|
1641
|
+
|
1642
|
+
it "behaves correctly when given a non-model instance" do
|
1643
|
+
expect(person.addresses.none?(1)).to be true
|
1644
|
+
end
|
1645
|
+
end
|
1436
1646
|
end
|
1437
1647
|
end
|
1438
1648
|
|
@@ -1441,11 +1651,11 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
1441
1651
|
context "when providing multiple attributes" do
|
1442
1652
|
|
1443
1653
|
let(:person) do
|
1444
|
-
Person.create
|
1654
|
+
Person.create!
|
1445
1655
|
end
|
1446
1656
|
|
1447
1657
|
let!(:addresses) do
|
1448
|
-
person.addresses.create([{ street: "Bond" }, { street: "Upper" }])
|
1658
|
+
person.addresses.create!([{ street: "Bond" }, { street: "Upper" }])
|
1449
1659
|
end
|
1450
1660
|
|
1451
1661
|
it "creates multiple documents" do
|
@@ -1468,11 +1678,11 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
1468
1678
|
context "when the relation is not cyclic" do
|
1469
1679
|
|
1470
1680
|
let(:person) do
|
1471
|
-
Person.create
|
1681
|
+
Person.create!
|
1472
1682
|
end
|
1473
1683
|
|
1474
1684
|
let!(:address) do
|
1475
|
-
person.addresses.create(street: "Bond") do |address|
|
1685
|
+
person.addresses.create!(street: "Bond") do |address|
|
1476
1686
|
address.state = "CA"
|
1477
1687
|
end
|
1478
1688
|
end
|
@@ -1516,7 +1726,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
1516
1726
|
context "when embedding a multi word named document" do
|
1517
1727
|
|
1518
1728
|
let!(:component) do
|
1519
|
-
person.address_components.create(street: "Test")
|
1729
|
+
person.address_components.create!(street: "Test")
|
1520
1730
|
end
|
1521
1731
|
|
1522
1732
|
it "saves the embedded document" do
|
@@ -1528,11 +1738,11 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
1528
1738
|
context "when the relation is cyclic" do
|
1529
1739
|
|
1530
1740
|
let!(:entry) do
|
1531
|
-
Entry.create(title: "hi")
|
1741
|
+
Entry.create!(title: "hi")
|
1532
1742
|
end
|
1533
1743
|
|
1534
1744
|
let!(:child_entry) do
|
1535
|
-
entry.child_entries.create(title: "hello")
|
1745
|
+
entry.child_entries.create!(title: "hello")
|
1536
1746
|
end
|
1537
1747
|
|
1538
1748
|
it "creates a new child" do
|
@@ -1544,7 +1754,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
1544
1754
|
describe "#create!" do
|
1545
1755
|
|
1546
1756
|
let(:person) do
|
1547
|
-
Person.create
|
1757
|
+
Person.create!
|
1548
1758
|
end
|
1549
1759
|
|
1550
1760
|
context "when providing multiple attributes" do
|
@@ -1703,7 +1913,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
1703
1913
|
describe "#delete_if" do
|
1704
1914
|
|
1705
1915
|
let(:person) do
|
1706
|
-
Person.create
|
1916
|
+
Person.create!
|
1707
1917
|
end
|
1708
1918
|
|
1709
1919
|
context "when the documents are new" do
|
@@ -1752,11 +1962,11 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
1752
1962
|
context "when the documents persisted" do
|
1753
1963
|
|
1754
1964
|
let!(:address_one) do
|
1755
|
-
person.addresses.create(street: "Bond")
|
1965
|
+
person.addresses.create!(street: "Bond")
|
1756
1966
|
end
|
1757
1967
|
|
1758
1968
|
let!(:address_two) do
|
1759
|
-
person.addresses.create(street: "Upper")
|
1969
|
+
person.addresses.create!(street: "Upper")
|
1760
1970
|
end
|
1761
1971
|
|
1762
1972
|
context "when a block is provided" do
|
@@ -1811,7 +2021,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
1811
2021
|
describe "##{method}" do
|
1812
2022
|
|
1813
2023
|
let(:person) do
|
1814
|
-
Person.create
|
2024
|
+
Person.create!
|
1815
2025
|
end
|
1816
2026
|
|
1817
2027
|
context "when the documents are new" do
|
@@ -1865,11 +2075,11 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
1865
2075
|
context "when the documents persisted" do
|
1866
2076
|
|
1867
2077
|
let!(:address_one) do
|
1868
|
-
person.addresses.create(street: "Bond")
|
2078
|
+
person.addresses.create!(street: "Bond")
|
1869
2079
|
end
|
1870
2080
|
|
1871
2081
|
let!(:address_two) do
|
1872
|
-
person.addresses.create(street: "Upper")
|
2082
|
+
person.addresses.create!(street: "Upper")
|
1873
2083
|
end
|
1874
2084
|
|
1875
2085
|
context "when conditions are provided" do
|
@@ -1916,7 +2126,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
1916
2126
|
context "when removing and resaving" do
|
1917
2127
|
|
1918
2128
|
let(:owner) do
|
1919
|
-
PetOwner.create(title: "AKC")
|
2129
|
+
PetOwner.create!(title: "AKC")
|
1920
2130
|
end
|
1921
2131
|
|
1922
2132
|
before do
|
@@ -2012,13 +2222,13 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
2012
2222
|
describe "#exists?" do
|
2013
2223
|
|
2014
2224
|
let!(:person) do
|
2015
|
-
Person.create
|
2225
|
+
Person.create!
|
2016
2226
|
end
|
2017
2227
|
|
2018
2228
|
context "when documents exist in the database" do
|
2019
2229
|
|
2020
2230
|
before do
|
2021
|
-
person.addresses.create(street: "Bond St")
|
2231
|
+
person.addresses.create!(street: "Bond St")
|
2022
2232
|
end
|
2023
2233
|
|
2024
2234
|
it "returns true" do
|
@@ -2149,12 +2359,50 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
2149
2359
|
end
|
2150
2360
|
end
|
2151
2361
|
end
|
2362
|
+
|
2363
|
+
context "with block" do
|
2364
|
+
let!(:author) do
|
2365
|
+
Person.create!(title: 'Person')
|
2366
|
+
end
|
2367
|
+
|
2368
|
+
let!(:video_one) do
|
2369
|
+
author.videos.create!(title: 'video one')
|
2370
|
+
end
|
2371
|
+
|
2372
|
+
let!(:video_two) do
|
2373
|
+
author.videos.create!(title: 'video two')
|
2374
|
+
end
|
2375
|
+
|
2376
|
+
it "finds one" do
|
2377
|
+
expect(
|
2378
|
+
author.videos.find do |video|
|
2379
|
+
video.title == 'video one'
|
2380
|
+
end
|
2381
|
+
).to eq(video_one)
|
2382
|
+
end
|
2383
|
+
|
2384
|
+
it "returns first match of multiple" do
|
2385
|
+
expect(
|
2386
|
+
author.videos.find do |video|
|
2387
|
+
['video one', 'video two'].include?(video.title)
|
2388
|
+
end
|
2389
|
+
).to be_a(Video)
|
2390
|
+
end
|
2391
|
+
|
2392
|
+
it "returns nil when not found" do
|
2393
|
+
expect(
|
2394
|
+
author.videos.find do |video|
|
2395
|
+
video.title == 'non exiting one'
|
2396
|
+
end
|
2397
|
+
).to be_nil
|
2398
|
+
end
|
2399
|
+
end
|
2152
2400
|
end
|
2153
2401
|
|
2154
2402
|
describe "#find_or_create_by" do
|
2155
2403
|
|
2156
2404
|
let(:person) do
|
2157
|
-
Person.create
|
2405
|
+
Person.create!
|
2158
2406
|
end
|
2159
2407
|
|
2160
2408
|
let!(:address) do
|
@@ -2197,11 +2445,11 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
2197
2445
|
# context "when the child belongs to another document" do
|
2198
2446
|
#
|
2199
2447
|
# let(:product) do
|
2200
|
-
# Product.create
|
2448
|
+
# Product.create!
|
2201
2449
|
# end
|
2202
2450
|
#
|
2203
2451
|
# let(:purchase) do
|
2204
|
-
# Purchase.create
|
2452
|
+
# Purchase.create!
|
2205
2453
|
# end
|
2206
2454
|
#
|
2207
2455
|
# let(:line_item) do
|
@@ -2220,7 +2468,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
2220
2468
|
describe "#find_or_create_by!" do
|
2221
2469
|
|
2222
2470
|
let(:person) do
|
2223
|
-
Person.create
|
2471
|
+
Person.create!
|
2224
2472
|
end
|
2225
2473
|
|
2226
2474
|
let!(:address) do
|
@@ -2272,11 +2520,11 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
2272
2520
|
# context "when the child belongs to another document" do
|
2273
2521
|
#
|
2274
2522
|
# let(:product) do
|
2275
|
-
# Product.create
|
2523
|
+
# Product.create!
|
2276
2524
|
# end
|
2277
2525
|
#
|
2278
2526
|
# let(:purchase) do
|
2279
|
-
# Purchase.create
|
2527
|
+
# Purchase.create!
|
2280
2528
|
# end
|
2281
2529
|
#
|
2282
2530
|
# let(:line_item) do
|
@@ -2394,11 +2642,11 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
2394
2642
|
describe "#method_missing" do
|
2395
2643
|
|
2396
2644
|
let!(:person) do
|
2397
|
-
Person.create
|
2645
|
+
Person.create!
|
2398
2646
|
end
|
2399
2647
|
|
2400
2648
|
let!(:address_one) do
|
2401
|
-
person.addresses.create(
|
2649
|
+
person.addresses.create!(
|
2402
2650
|
street: "Market",
|
2403
2651
|
state: "CA",
|
2404
2652
|
services: [ "1", "2" ]
|
@@ -2406,7 +2654,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
2406
2654
|
end
|
2407
2655
|
|
2408
2656
|
let!(:address_two) do
|
2409
|
-
person.addresses.create(
|
2657
|
+
person.addresses.create!(
|
2410
2658
|
street: "Madison",
|
2411
2659
|
state: "NY",
|
2412
2660
|
services: [ "1", "2" ]
|
@@ -2554,17 +2802,17 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
2554
2802
|
describe "#pop" do
|
2555
2803
|
|
2556
2804
|
let(:person) do
|
2557
|
-
Person.create
|
2805
|
+
Person.create!
|
2558
2806
|
end
|
2559
2807
|
|
2560
2808
|
context "when no argument is provided" do
|
2561
2809
|
|
2562
2810
|
let!(:address_one) do
|
2563
|
-
person.addresses.create(street: "sonnenallee")
|
2811
|
+
person.addresses.create!(street: "sonnenallee")
|
2564
2812
|
end
|
2565
2813
|
|
2566
2814
|
let!(:address_two) do
|
2567
|
-
person.addresses.create(street: "hermannstr")
|
2815
|
+
person.addresses.create!(street: "hermannstr")
|
2568
2816
|
end
|
2569
2817
|
|
2570
2818
|
let!(:popped) do
|
@@ -2587,11 +2835,11 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
2587
2835
|
context "when an integer is provided" do
|
2588
2836
|
|
2589
2837
|
let!(:address_one) do
|
2590
|
-
person.addresses.create(street: "sonnenallee")
|
2838
|
+
person.addresses.create!(street: "sonnenallee")
|
2591
2839
|
end
|
2592
2840
|
|
2593
2841
|
let!(:address_two) do
|
2594
|
-
person.addresses.create(street: "hermannstr")
|
2842
|
+
person.addresses.create!(street: "hermannstr")
|
2595
2843
|
end
|
2596
2844
|
|
2597
2845
|
context "when the number is zero" do
|
@@ -2673,17 +2921,17 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
2673
2921
|
describe "#shift" do
|
2674
2922
|
|
2675
2923
|
let(:person) do
|
2676
|
-
Person.create
|
2924
|
+
Person.create!
|
2677
2925
|
end
|
2678
2926
|
|
2679
2927
|
context "when no argument is provided" do
|
2680
2928
|
|
2681
2929
|
let!(:address_one) do
|
2682
|
-
person.addresses.create(street: "sonnenallee")
|
2930
|
+
person.addresses.create!(street: "sonnenallee")
|
2683
2931
|
end
|
2684
2932
|
|
2685
2933
|
let!(:address_two) do
|
2686
|
-
person.addresses.create(street: "hermannstr")
|
2934
|
+
person.addresses.create!(street: "hermannstr")
|
2687
2935
|
end
|
2688
2936
|
|
2689
2937
|
let!(:shifted) do
|
@@ -2706,11 +2954,11 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
2706
2954
|
context "when an integer is provided" do
|
2707
2955
|
|
2708
2956
|
let!(:address_one) do
|
2709
|
-
person.addresses.create(street: "sonnenallee")
|
2957
|
+
person.addresses.create!(street: "sonnenallee")
|
2710
2958
|
end
|
2711
2959
|
|
2712
2960
|
let!(:address_two) do
|
2713
|
-
person.addresses.create(street: "hermannstr")
|
2961
|
+
person.addresses.create!(street: "hermannstr")
|
2714
2962
|
end
|
2715
2963
|
|
2716
2964
|
context "when the number is zero" do
|
@@ -2858,11 +3106,11 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
2858
3106
|
describe "##{method}" do
|
2859
3107
|
|
2860
3108
|
let(:person) do
|
2861
|
-
Person.create
|
3109
|
+
Person.create!
|
2862
3110
|
end
|
2863
3111
|
|
2864
3112
|
before do
|
2865
|
-
person.addresses.create(street: "Upper")
|
3113
|
+
person.addresses.create!(street: "Upper")
|
2866
3114
|
person.addresses.build(street: "Bond")
|
2867
3115
|
end
|
2868
3116
|
|
@@ -2900,7 +3148,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
2900
3148
|
context "when there are no documents present" do
|
2901
3149
|
|
2902
3150
|
let(:person) do
|
2903
|
-
Person.create
|
3151
|
+
Person.create!
|
2904
3152
|
end
|
2905
3153
|
|
2906
3154
|
it "updates nothing" do
|
@@ -2911,11 +3159,11 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
2911
3159
|
context "when documents are present" do
|
2912
3160
|
|
2913
3161
|
let(:person) do
|
2914
|
-
Person.create
|
3162
|
+
Person.create!
|
2915
3163
|
end
|
2916
3164
|
|
2917
3165
|
let!(:address) do
|
2918
|
-
person.addresses.create(street: "Hobrecht", number: 27)
|
3166
|
+
person.addresses.create!(street: "Hobrecht", number: 27)
|
2919
3167
|
end
|
2920
3168
|
|
2921
3169
|
context "when updating with a where clause" do
|
@@ -2950,16 +3198,16 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
2950
3198
|
context "when updating the bottom level" do
|
2951
3199
|
|
2952
3200
|
let!(:person) do
|
2953
|
-
Person.create
|
3201
|
+
Person.create!
|
2954
3202
|
end
|
2955
3203
|
|
2956
3204
|
let!(:address) do
|
2957
|
-
person.addresses.create(street: "Joachimstr")
|
3205
|
+
person.addresses.create!(street: "Joachimstr")
|
2958
3206
|
end
|
2959
3207
|
|
2960
3208
|
let!(:location) do
|
2961
|
-
address.locations.create(name: "vacation", number: 0)
|
2962
|
-
address.locations.create(name: "work", number: 3)
|
3209
|
+
address.locations.create!(name: "vacation", number: 0)
|
3210
|
+
address.locations.create!(name: "work", number: 3)
|
2963
3211
|
end
|
2964
3212
|
|
2965
3213
|
context "when updating with replacement of embedded array" do
|
@@ -2967,7 +3215,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
2967
3215
|
context "when updating with a hash" do
|
2968
3216
|
|
2969
3217
|
before do
|
2970
|
-
address.update_attributes(locations: [{ name: "home" }])
|
3218
|
+
address.update_attributes!(locations: [{ name: "home" }])
|
2971
3219
|
end
|
2972
3220
|
|
2973
3221
|
it "updates the attributes" do
|
@@ -2988,7 +3236,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
2988
3236
|
|
2989
3237
|
before do
|
2990
3238
|
location.number = 7
|
2991
|
-
location.save
|
3239
|
+
location.save!
|
2992
3240
|
end
|
2993
3241
|
|
2994
3242
|
let(:updated_location_number) do
|
@@ -3121,7 +3369,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
3121
3369
|
context "when creating a persisted tree" do
|
3122
3370
|
|
3123
3371
|
let(:quiz) do
|
3124
|
-
Quiz.create
|
3372
|
+
Quiz.create!
|
3125
3373
|
end
|
3126
3374
|
|
3127
3375
|
let(:page) do
|
@@ -3186,7 +3434,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
3186
3434
|
context "when saving the root" do
|
3187
3435
|
|
3188
3436
|
before do
|
3189
|
-
person.save
|
3437
|
+
person.save!
|
3190
3438
|
end
|
3191
3439
|
|
3192
3440
|
it "persists the first level document" do
|
@@ -3340,11 +3588,11 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
3340
3588
|
context "when accessing the parent in a destroy callback" do
|
3341
3589
|
|
3342
3590
|
let!(:league) do
|
3343
|
-
League.create
|
3591
|
+
League.create!
|
3344
3592
|
end
|
3345
3593
|
|
3346
3594
|
let!(:division) do
|
3347
|
-
league.divisions.create
|
3595
|
+
league.divisions.create!
|
3348
3596
|
end
|
3349
3597
|
|
3350
3598
|
before do
|
@@ -3359,15 +3607,15 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
3359
3607
|
context "when updating the parent with all attributes" do
|
3360
3608
|
|
3361
3609
|
let!(:person) do
|
3362
|
-
Person.create
|
3610
|
+
Person.create!
|
3363
3611
|
end
|
3364
3612
|
|
3365
3613
|
let!(:address) do
|
3366
|
-
person.addresses.create
|
3614
|
+
person.addresses.create!
|
3367
3615
|
end
|
3368
3616
|
|
3369
3617
|
before do
|
3370
|
-
person.update_attributes(person.attributes)
|
3618
|
+
person.update_attributes!(person.attributes)
|
3371
3619
|
end
|
3372
3620
|
|
3373
3621
|
it "does not duplicate the embedded documents" do
|
@@ -3382,13 +3630,13 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
3382
3630
|
context "when embedding children named versions" do
|
3383
3631
|
|
3384
3632
|
let(:acolyte) do
|
3385
|
-
Acolyte.create(name: "test")
|
3633
|
+
Acolyte.create!(name: "test")
|
3386
3634
|
end
|
3387
3635
|
|
3388
3636
|
context "when creating a child" do
|
3389
3637
|
|
3390
3638
|
let(:version) do
|
3391
|
-
acolyte.versions.create(number: 1)
|
3639
|
+
acolyte.versions.create!(number: 1)
|
3392
3640
|
end
|
3393
3641
|
|
3394
3642
|
it "allows the operation" do
|
@@ -3413,7 +3661,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
3413
3661
|
let!(:account) do
|
3414
3662
|
Account.new(name: "Testing").tap do |acct|
|
3415
3663
|
acct.memberships.build
|
3416
|
-
acct.save
|
3664
|
+
acct.save!
|
3417
3665
|
end
|
3418
3666
|
end
|
3419
3667
|
|
@@ -3425,10 +3673,10 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
3425
3673
|
|
3426
3674
|
before do
|
3427
3675
|
account.name = ""
|
3428
|
-
account.save
|
3429
3676
|
end
|
3430
3677
|
|
3431
3678
|
it "does not lose the parent reference" do
|
3679
|
+
expect(account.save).to eq false
|
3432
3680
|
expect(from_db.memberships.first.account).to eq(account)
|
3433
3681
|
end
|
3434
3682
|
end
|
@@ -3448,15 +3696,15 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
3448
3696
|
context "when moving an embedded document from one parent to another" do
|
3449
3697
|
|
3450
3698
|
let!(:person_one) do
|
3451
|
-
Person.create
|
3699
|
+
Person.create!
|
3452
3700
|
end
|
3453
3701
|
|
3454
3702
|
let!(:person_two) do
|
3455
|
-
Person.create
|
3703
|
+
Person.create!
|
3456
3704
|
end
|
3457
3705
|
|
3458
3706
|
let!(:address) do
|
3459
|
-
person_one.addresses.create(street: "Kudamm")
|
3707
|
+
person_one.addresses.create!(street: "Kudamm")
|
3460
3708
|
end
|
3461
3709
|
|
3462
3710
|
before do
|
@@ -3491,7 +3739,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
3491
3739
|
context "when the relation has a default scope" do
|
3492
3740
|
|
3493
3741
|
let!(:person) do
|
3494
|
-
Person.create
|
3742
|
+
Person.create!
|
3495
3743
|
end
|
3496
3744
|
|
3497
3745
|
context "when the default scope is a sort" do
|
@@ -3561,7 +3809,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
3561
3809
|
context "when indexing the documents" do
|
3562
3810
|
|
3563
3811
|
let!(:person) do
|
3564
|
-
Person.create
|
3812
|
+
Person.create!
|
3565
3813
|
end
|
3566
3814
|
|
3567
3815
|
context "when the documents have a limiting default scope" do
|
@@ -3610,18 +3858,18 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
3610
3858
|
context "when the embedded document has an array field" do
|
3611
3859
|
|
3612
3860
|
let!(:person) do
|
3613
|
-
Person.create
|
3861
|
+
Person.create!
|
3614
3862
|
end
|
3615
3863
|
|
3616
3864
|
let!(:video) do
|
3617
|
-
person.videos.create
|
3865
|
+
person.videos.create!
|
3618
3866
|
end
|
3619
3867
|
|
3620
3868
|
context "when saving the array on a persisted document" do
|
3621
3869
|
|
3622
3870
|
before do
|
3623
3871
|
video.genres = [ "horror", "scifi" ]
|
3624
|
-
video.save
|
3872
|
+
video.save!
|
3625
3873
|
end
|
3626
3874
|
|
3627
3875
|
it "sets the value" do
|
@@ -3646,7 +3894,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
3646
3894
|
|
3647
3895
|
before do
|
3648
3896
|
loaded_video.genres = [ "comedy" ]
|
3649
|
-
loaded_video.save
|
3897
|
+
loaded_video.save!
|
3650
3898
|
end
|
3651
3899
|
|
3652
3900
|
it "sets the new value" do
|
@@ -3664,15 +3912,15 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
3664
3912
|
context "when destroying an embedded document" do
|
3665
3913
|
|
3666
3914
|
let(:person) do
|
3667
|
-
Person.create
|
3915
|
+
Person.create!
|
3668
3916
|
end
|
3669
3917
|
|
3670
3918
|
let!(:address_one) do
|
3671
|
-
person.addresses.create(street: "hobrecht")
|
3919
|
+
person.addresses.create!(street: "hobrecht")
|
3672
3920
|
end
|
3673
3921
|
|
3674
3922
|
let!(:address_two) do
|
3675
|
-
person.addresses.create(street: "maybachufer")
|
3923
|
+
person.addresses.create!(street: "maybachufer")
|
3676
3924
|
end
|
3677
3925
|
|
3678
3926
|
before do
|
@@ -3744,7 +3992,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
3744
3992
|
context "when the association has an order defined" do
|
3745
3993
|
|
3746
3994
|
let(:person) do
|
3747
|
-
Person.create
|
3995
|
+
Person.create!
|
3748
3996
|
end
|
3749
3997
|
|
3750
3998
|
let(:message_one) do
|
@@ -3775,11 +4023,11 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
3775
4023
|
|
3776
4024
|
before do
|
3777
4025
|
person.aliases = [ { name: "A", priority: 3 }, { name: "B", priority: 4 }]
|
3778
|
-
person.save
|
4026
|
+
person.save!
|
3779
4027
|
end
|
3780
4028
|
|
3781
4029
|
let!(:person2) do
|
3782
|
-
Person.create( aliases: [ { name: "C", priority: 1 }, { name: "D", priority: 2 }])
|
4030
|
+
Person.create!( aliases: [ { name: "C", priority: 1 }, { name: "D", priority: 2 }])
|
3783
4031
|
end
|
3784
4032
|
|
3785
4033
|
it "allows ordering on a key of an embedded document" do
|
@@ -3814,7 +4062,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
3814
4062
|
context "when updating multiple levels in one update" do
|
3815
4063
|
|
3816
4064
|
let!(:person) do
|
3817
|
-
Person.create(
|
4065
|
+
Person.create!(
|
3818
4066
|
addresses: [
|
3819
4067
|
{ locations: [{ name: "home" }]}
|
3820
4068
|
]
|
@@ -3828,7 +4076,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
3828
4076
|
end
|
3829
4077
|
|
3830
4078
|
before do
|
3831
|
-
from_db.update_attributes(
|
4079
|
+
from_db.update_attributes!(
|
3832
4080
|
addresses: [
|
3833
4081
|
{ locations: [{ name: "work" }]}
|
3834
4082
|
]
|
@@ -3848,15 +4096,15 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
3848
4096
|
context "when the embedded relation sorts on a boolean" do
|
3849
4097
|
|
3850
4098
|
let(:circuit) do
|
3851
|
-
Circuit.create
|
4099
|
+
Circuit.create!
|
3852
4100
|
end
|
3853
4101
|
|
3854
4102
|
let!(:bus_one) do
|
3855
|
-
circuit.buses.create(saturday: true)
|
4103
|
+
circuit.buses.create!(saturday: true)
|
3856
4104
|
end
|
3857
4105
|
|
3858
4106
|
let!(:bus_two) do
|
3859
|
-
circuit.buses.create(saturday: false)
|
4107
|
+
circuit.buses.create!(saturday: false)
|
3860
4108
|
end
|
3861
4109
|
|
3862
4110
|
it "orders properly with the boolean" do
|
@@ -3867,7 +4115,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
3867
4115
|
context "when batch replacing multiple relations in a single update" do
|
3868
4116
|
|
3869
4117
|
let(:document) do
|
3870
|
-
Person.create
|
4118
|
+
Person.create!
|
3871
4119
|
end
|
3872
4120
|
|
3873
4121
|
let(:person) do
|
@@ -3875,23 +4123,23 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
3875
4123
|
end
|
3876
4124
|
|
3877
4125
|
let!(:symptom_one) do
|
3878
|
-
person.symptoms.create
|
4126
|
+
person.symptoms.create!
|
3879
4127
|
end
|
3880
4128
|
|
3881
4129
|
let!(:symptom_two) do
|
3882
|
-
person.symptoms.create
|
4130
|
+
person.symptoms.create!
|
3883
4131
|
end
|
3884
4132
|
|
3885
4133
|
let!(:appointment_one) do
|
3886
|
-
person.appointments.create
|
4134
|
+
person.appointments.create!
|
3887
4135
|
end
|
3888
4136
|
|
3889
4137
|
let!(:appointment_two) do
|
3890
|
-
person.appointments.create
|
4138
|
+
person.appointments.create!
|
3891
4139
|
end
|
3892
4140
|
|
3893
4141
|
before do
|
3894
|
-
person.update_attributes(
|
4142
|
+
person.update_attributes!(
|
3895
4143
|
appointments: [ appointment_one.as_document, appointment_two.as_document ],
|
3896
4144
|
symptoms: [ symptom_one.as_document, symptom_two.as_document ]
|
3897
4145
|
)
|
@@ -4224,7 +4472,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
4224
4472
|
context "when the parent has an after create callback" do
|
4225
4473
|
|
4226
4474
|
before do
|
4227
|
-
server.save
|
4475
|
+
server.save!
|
4228
4476
|
end
|
4229
4477
|
|
4230
4478
|
it "does not push the embedded documents twice" do
|
@@ -4236,7 +4484,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
4236
4484
|
context "when embedded documents are stored without ids" do
|
4237
4485
|
|
4238
4486
|
let!(:band) do
|
4239
|
-
Band.create(name: "Moderat")
|
4487
|
+
Band.create!(name: "Moderat")
|
4240
4488
|
end
|
4241
4489
|
|
4242
4490
|
before do
|
@@ -4286,7 +4534,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
4286
4534
|
company = Company.new
|
4287
4535
|
4.times { |i| company.staffs << Staff.new(age: 50 + i)}
|
4288
4536
|
2.times { |i| company.staffs << Staff.new(age: 40)}
|
4289
|
-
company.save
|
4537
|
+
company.save!
|
4290
4538
|
company.staffs.delete_if {|x| x.age >= 50}
|
4291
4539
|
expect(company.staffs.count).to eq(2)
|
4292
4540
|
end
|
@@ -4363,7 +4611,7 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
4363
4611
|
context "when the parent is persisted" do
|
4364
4612
|
|
4365
4613
|
let(:zone) do
|
4366
|
-
DNS::Zone.create
|
4614
|
+
DNS::Zone.create!
|
4367
4615
|
end
|
4368
4616
|
|
4369
4617
|
let(:soa_1) do
|
@@ -4401,24 +4649,4 @@ describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
|
|
4401
4649
|
end
|
4402
4650
|
end
|
4403
4651
|
end
|
4404
|
-
|
4405
|
-
context "when using assign_attributes with an already populated array" do
|
4406
|
-
let(:post) { EmmPost.create! }
|
4407
|
-
|
4408
|
-
before do
|
4409
|
-
post.assign_attributes(company_tags: [{id: BSON::ObjectId.new, title: 'a'}],
|
4410
|
-
user_tags: [{id: BSON::ObjectId.new, title: 'b'}])
|
4411
|
-
post.save!
|
4412
|
-
post.reload
|
4413
|
-
post.assign_attributes(company_tags: [{id: BSON::ObjectId.new, title: 'c'}],
|
4414
|
-
user_tags: [])
|
4415
|
-
post.save!
|
4416
|
-
post.reload
|
4417
|
-
end
|
4418
|
-
|
4419
|
-
it "has the correct embedded documents" do
|
4420
|
-
expect(post.company_tags.length).to eq(1)
|
4421
|
-
expect(post.company_tags.first.title).to eq("c")
|
4422
|
-
end
|
4423
|
-
end
|
4424
4652
|
end
|