mongo 2.2.7 → 2.3.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.tar.gz.sig +0 -0
- data/LICENSE +1 -1
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/lib/mongo.rb +1 -1
- data/lib/mongo/address.rb +1 -1
- data/lib/mongo/address/ipv4.rb +1 -1
- data/lib/mongo/address/ipv6.rb +1 -1
- data/lib/mongo/address/unix.rb +1 -1
- data/lib/mongo/auth.rb +1 -1
- data/lib/mongo/auth/cr.rb +1 -1
- data/lib/mongo/auth/ldap.rb +1 -1
- data/lib/mongo/auth/roles.rb +1 -1
- data/lib/mongo/auth/user.rb +1 -1
- data/lib/mongo/auth/user/view.rb +5 -5
- data/lib/mongo/auth/x509.rb +1 -1
- data/lib/mongo/bson.rb +1 -1
- data/lib/mongo/bulk_write.rb +4 -4
- data/lib/mongo/bulk_write/combineable.rb +1 -1
- data/lib/mongo/bulk_write/ordered_combiner.rb +1 -1
- data/lib/mongo/bulk_write/result.rb +1 -1
- data/lib/mongo/bulk_write/result_combiner.rb +1 -1
- data/lib/mongo/bulk_write/transformable.rb +1 -1
- data/lib/mongo/bulk_write/unordered_combiner.rb +1 -1
- data/lib/mongo/bulk_write/validatable.rb +1 -1
- data/lib/mongo/client.rb +2 -2
- data/lib/mongo/cluster.rb +15 -3
- data/lib/mongo/cluster/cursor_reaper.rb +174 -0
- data/lib/mongo/cluster/topology.rb +1 -1
- data/lib/mongo/cluster/topology/replica_set.rb +1 -1
- data/lib/mongo/cluster/topology/sharded.rb +1 -1
- data/lib/mongo/cluster/topology/single.rb +1 -1
- data/lib/mongo/cluster/topology/unknown.rb +1 -1
- data/lib/mongo/collection.rb +5 -4
- data/lib/mongo/collection/view.rb +4 -4
- data/lib/mongo/collection/view/aggregation.rb +2 -2
- data/lib/mongo/collection/view/builder.rb +1 -1
- data/lib/mongo/collection/view/builder/aggregation.rb +1 -1
- data/lib/mongo/collection/view/builder/find_command.rb +1 -1
- data/lib/mongo/collection/view/builder/flags.rb +1 -1
- data/lib/mongo/collection/view/builder/map_reduce.rb +1 -1
- data/lib/mongo/collection/view/builder/modifiers.rb +1 -1
- data/lib/mongo/collection/view/builder/op_query.rb +1 -1
- data/lib/mongo/collection/view/explainable.rb +1 -1
- data/lib/mongo/collection/view/immutable.rb +1 -1
- data/lib/mongo/collection/view/iterable.rb +2 -2
- data/lib/mongo/collection/view/map_reduce.rb +3 -3
- data/lib/mongo/collection/view/readable.rb +23 -6
- data/lib/mongo/collection/view/writable.rb +3 -3
- data/lib/mongo/cursor.rb +50 -7
- data/lib/mongo/cursor/builder.rb +1 -1
- data/lib/mongo/cursor/builder/get_more_command.rb +1 -1
- data/lib/mongo/cursor/builder/kill_cursors_command.rb +29 -1
- data/lib/mongo/cursor/builder/op_get_more.rb +1 -1
- data/lib/mongo/cursor/builder/op_kill_cursors.rb +29 -1
- data/lib/mongo/database.rb +4 -4
- data/lib/mongo/database/view.rb +2 -2
- data/lib/mongo/dbref.rb +4 -3
- data/lib/mongo/error.rb +1 -1
- data/lib/mongo/error/bulk_write_error.rb +1 -1
- data/lib/mongo/error/closed_stream.rb +1 -1
- data/lib/mongo/error/extra_file_chunk.rb +1 -1
- data/lib/mongo/error/file_not_found.rb +1 -1
- data/lib/mongo/error/invalid_bulk_operation.rb +1 -1
- data/lib/mongo/error/invalid_bulk_operation_type.rb +1 -1
- data/lib/mongo/error/invalid_collection_name.rb +1 -1
- data/lib/mongo/error/invalid_database_name.rb +1 -1
- data/lib/mongo/error/invalid_document.rb +1 -1
- data/lib/mongo/error/invalid_file.rb +1 -1
- data/lib/mongo/error/invalid_file_revision.rb +1 -1
- data/lib/mongo/error/invalid_nonce.rb +1 -1
- data/lib/mongo/error/invalid_replacement_document.rb +1 -1
- data/lib/mongo/error/invalid_server_preference.rb +1 -1
- data/lib/mongo/error/invalid_signature.rb +1 -1
- data/lib/mongo/error/invalid_update_document.rb +1 -1
- data/lib/mongo/error/invalid_uri.rb +1 -1
- data/lib/mongo/error/invalid_write_concern.rb +1 -1
- data/lib/mongo/error/max_bson_size.rb +1 -1
- data/lib/mongo/error/max_message_size.rb +1 -1
- data/lib/mongo/error/missing_file_chunk.rb +1 -1
- data/lib/mongo/error/multi_index_drop.rb +1 -1
- data/lib/mongo/error/need_primary_server.rb +1 -1
- data/lib/mongo/error/no_server_available.rb +4 -2
- data/lib/mongo/error/operation_failure.rb +1 -1
- data/lib/mongo/error/parser.rb +1 -1
- data/lib/mongo/error/socket_error.rb +1 -1
- data/lib/mongo/error/socket_timeout_error.rb +1 -1
- data/lib/mongo/error/unchangeable_collection_option.rb +1 -1
- data/lib/mongo/error/unexpected_chunk_length.rb +1 -1
- data/lib/mongo/error/unexpected_response.rb +1 -1
- data/lib/mongo/error/unsupported_features.rb +1 -1
- data/lib/mongo/event.rb +1 -1
- data/lib/mongo/event/description_changed.rb +1 -1
- data/lib/mongo/event/publisher.rb +1 -1
- data/lib/mongo/event/subscriber.rb +1 -1
- data/lib/mongo/grid.rb +1 -1
- data/lib/mongo/grid/file.rb +6 -2
- data/lib/mongo/grid/file/chunk.rb +6 -4
- data/lib/mongo/grid/file/info.rb +7 -3
- data/lib/mongo/grid/fs_bucket.rb +12 -6
- data/lib/mongo/grid/stream.rb +1 -1
- data/lib/mongo/grid/stream/read.rb +2 -4
- data/lib/mongo/grid/stream/write.rb +4 -3
- data/lib/mongo/index.rb +1 -1
- data/lib/mongo/index/view.rb +5 -4
- data/lib/mongo/loggable.rb +1 -1
- data/lib/mongo/logger.rb +1 -1
- data/lib/mongo/monitoring.rb +1 -1
- data/lib/mongo/operation.rb +1 -1
- data/lib/mongo/operation/commands.rb +1 -1
- data/lib/mongo/operation/commands/aggregate.rb +7 -7
- data/lib/mongo/operation/commands/aggregate/result.rb +1 -1
- data/lib/mongo/operation/commands/collections_info.rb +10 -9
- data/lib/mongo/operation/commands/collections_info/result.rb +1 -1
- data/lib/mongo/operation/commands/command.rb +1 -1
- data/lib/mongo/operation/commands/indexes.rb +12 -11
- data/lib/mongo/operation/commands/list_collections.rb +1 -1
- data/lib/mongo/operation/commands/list_collections/result.rb +1 -1
- data/lib/mongo/operation/commands/list_indexes.rb +1 -1
- data/lib/mongo/operation/commands/list_indexes/result.rb +1 -1
- data/lib/mongo/operation/commands/map_reduce.rb +1 -1
- data/lib/mongo/operation/commands/map_reduce/result.rb +1 -1
- data/lib/mongo/operation/commands/user_query.rb +11 -10
- data/lib/mongo/operation/commands/users_info.rb +2 -2
- data/lib/mongo/operation/commands/users_info/result.rb +1 -1
- data/lib/mongo/operation/executable.rb +8 -7
- data/lib/mongo/operation/kill_cursors.rb +2 -2
- data/lib/mongo/operation/limited.rb +1 -1
- data/lib/mongo/operation/read.rb +1 -1
- data/lib/mongo/operation/read/get_more.rb +2 -2
- data/lib/mongo/operation/read/query.rb +1 -1
- data/lib/mongo/operation/read/query/result.rb +1 -1
- data/lib/mongo/operation/read_preference.rb +10 -10
- data/lib/mongo/operation/result.rb +1 -1
- data/lib/mongo/operation/specifiable.rb +2 -2
- data/lib/mongo/operation/write.rb +1 -1
- data/lib/mongo/operation/write/bulk.rb +1 -1
- data/lib/mongo/operation/write/bulk/bulkable.rb +9 -9
- data/lib/mongo/operation/write/bulk/delete.rb +3 -3
- data/lib/mongo/operation/write/bulk/delete/result.rb +1 -1
- data/lib/mongo/operation/write/bulk/insert.rb +5 -5
- data/lib/mongo/operation/write/bulk/insert/result.rb +1 -1
- data/lib/mongo/operation/write/bulk/legacy_mergable.rb +1 -1
- data/lib/mongo/operation/write/bulk/mergable.rb +1 -1
- data/lib/mongo/operation/write/bulk/update.rb +3 -3
- data/lib/mongo/operation/write/bulk/update/result.rb +1 -1
- data/lib/mongo/operation/write/command.rb +1 -1
- data/lib/mongo/operation/write/command/create_index.rb +1 -1
- data/lib/mongo/operation/write/command/create_user.rb +1 -1
- data/lib/mongo/operation/write/command/delete.rb +1 -1
- data/lib/mongo/operation/write/command/drop_index.rb +1 -1
- data/lib/mongo/operation/write/command/insert.rb +11 -1
- data/lib/mongo/operation/write/command/remove_user.rb +1 -1
- data/lib/mongo/operation/write/command/update.rb +1 -1
- data/lib/mongo/operation/write/command/update_user.rb +1 -1
- data/lib/mongo/operation/write/command/writable.rb +7 -6
- data/lib/mongo/operation/write/create_index.rb +1 -1
- data/lib/mongo/operation/write/create_user.rb +1 -1
- data/lib/mongo/operation/write/delete.rb +1 -1
- data/lib/mongo/operation/write/delete/result.rb +1 -1
- data/lib/mongo/operation/write/drop_index.rb +5 -5
- data/lib/mongo/operation/write/gle.rb +3 -3
- data/lib/mongo/operation/write/idable.rb +1 -1
- data/lib/mongo/operation/write/insert.rb +5 -5
- data/lib/mongo/operation/write/insert/result.rb +1 -1
- data/lib/mongo/operation/write/remove_user.rb +1 -1
- data/lib/mongo/operation/write/update.rb +1 -1
- data/lib/mongo/operation/write/update/result.rb +1 -1
- data/lib/mongo/operation/write/update_user.rb +1 -1
- data/lib/mongo/operation/write/write_command_enabled.rb +10 -9
- data/lib/mongo/protocol/bit_vector.rb +2 -2
- data/lib/mongo/protocol/delete.rb +1 -1
- data/lib/mongo/protocol/get_more.rb +1 -1
- data/lib/mongo/protocol/insert.rb +5 -1
- data/lib/mongo/protocol/kill_cursors.rb +1 -1
- data/lib/mongo/protocol/message.rb +9 -5
- data/lib/mongo/protocol/query.rb +1 -1
- data/lib/mongo/protocol/reply.rb +1 -1
- data/lib/mongo/protocol/serializers.rb +8 -8
- data/lib/mongo/protocol/update.rb +1 -1
- data/lib/mongo/server.rb +40 -3
- data/lib/mongo/server/connectable.rb +1 -1
- data/lib/mongo/server/connection.rb +4 -2
- data/lib/mongo/server/connection_pool.rb +1 -1
- data/lib/mongo/server/connection_pool/queue.rb +1 -1
- data/lib/mongo/server/context.rb +3 -1
- data/lib/mongo/server/description.rb +1 -1
- data/lib/mongo/server/description/inspector/description_changed.rb +1 -1
- data/lib/mongo/server/monitor.rb +1 -1
- data/lib/mongo/server_selector.rb +2 -1
- data/lib/mongo/server_selector/nearest.rb +1 -1
- data/lib/mongo/server_selector/primary.rb +1 -1
- data/lib/mongo/server_selector/primary_preferred.rb +1 -1
- data/lib/mongo/server_selector/secondary.rb +1 -1
- data/lib/mongo/server_selector/secondary_preferred.rb +1 -1
- data/lib/mongo/server_selector/selectable.rb +12 -7
- data/lib/mongo/socket.rb +1 -1
- data/lib/mongo/socket/ssl.rb +1 -1
- data/lib/mongo/socket/tcp.rb +1 -1
- data/lib/mongo/socket/unix.rb +1 -1
- data/lib/mongo/uri.rb +1 -1
- data/lib/mongo/version.rb +2 -2
- data/lib/mongo/write_concern/acknowledged.rb +1 -1
- data/lib/mongo/write_concern/normalizable.rb +1 -1
- data/lib/mongo/write_concern/unacknowledged.rb +1 -1
- data/mongo.gemspec +1 -1
- data/spec/mongo/client_spec.rb +2 -2
- data/spec/mongo/cluster/cursor_reaper_spec.rb +216 -0
- data/spec/mongo/cluster_spec.rb +36 -5
- data/spec/mongo/collection/view/aggregation_spec.rb +2 -2
- data/spec/mongo/collection/view/map_reduce_spec.rb +2 -2
- data/spec/mongo/collection/view/readable_spec.rb +203 -5
- data/spec/mongo/collection/view_spec.rb +10 -0
- data/spec/mongo/collection_spec.rb +64 -18
- data/spec/mongo/cursor_spec.rb +89 -0
- data/spec/mongo/database_spec.rb +79 -13
- data/spec/mongo/grid/fs_bucket_spec.rb +119 -1
- data/spec/mongo/grid/stream/write_spec.rb +63 -12
- data/spec/mongo/index/view_spec.rb +19 -0
- data/spec/mongo/operation/commands/aggregate_spec.rb +10 -7
- data/spec/mongo/operation/commands/collections_info_spec.rb +1 -1
- data/spec/mongo/operation/commands/command_spec.rb +3 -3
- data/spec/mongo/operation/commands/indexes_spec.rb +1 -1
- data/spec/mongo/operation/commands/map_reduce_spec.rb +2 -2
- data/spec/mongo/operation/kill_cursors_spec.rb +10 -19
- data/spec/mongo/operation/read/get_more_spec.rb +13 -25
- data/spec/mongo/operation/read/query_spec.rb +26 -30
- data/spec/mongo/operation/read_preference_spec.rb +11 -11
- data/spec/mongo/operation/specifiable_spec.rb +31 -0
- data/spec/mongo/operation/write/bulk/delete_spec.rb +16 -18
- data/spec/mongo/operation/write/bulk/insert_spec.rb +17 -18
- data/spec/mongo/operation/write/bulk/update_spec.rb +20 -25
- data/spec/mongo/operation/write/command/delete_spec.rb +26 -32
- data/spec/mongo/operation/write/command/insert_spec.rb +24 -31
- data/spec/mongo/operation/write/command/update_spec.rb +24 -32
- data/spec/mongo/operation/write/create_index_spec.rb +4 -4
- data/spec/mongo/operation/write/create_user_spec.rb +3 -3
- data/spec/mongo/operation/write/delete_spec.rb +51 -22
- data/spec/mongo/operation/write/drop_index_spec.rb +2 -2
- data/spec/mongo/operation/write/insert_spec.rb +42 -11
- data/spec/mongo/operation/write/remove_user_spec.rb +4 -4
- data/spec/mongo/operation/write/update_spec.rb +34 -6
- data/spec/mongo/operation/write/update_user_spec.rb +1 -1
- data/spec/mongo/server/connection_spec.rb +22 -14
- data/spec/mongo/server_selection_spec.rb +2 -2
- data/spec/mongo/server_selector/nearest_spec.rb +4 -4
- data/spec/mongo/server_selector/primary_preferred_spec.rb +4 -4
- data/spec/mongo/server_selector/primary_spec.rb +2 -2
- data/spec/mongo/server_selector/secondary_preferred_spec.rb +4 -4
- data/spec/mongo/server_selector/secondary_spec.rb +3 -3
- data/spec/mongo/server_selector_spec.rb +82 -3
- data/spec/mongo/server_spec.rb +0 -20
- data/spec/support/command_monitoring.rb +1 -1
- data/spec/support/connection_string.rb +1 -1
- data/spec/support/crud.rb +1 -1
- data/spec/support/crud/read.rb +1 -1
- data/spec/support/crud/write.rb +1 -1
- data/spec/support/gridfs.rb +1 -1
- data/spec/support/shared/server_selector.rb +3 -3
- metadata +7 -10
- metadata.gz.sig +0 -0
- data/lib/csasl/csasl.bundle +0 -0
- data/spec/mongo/operation/write/response_spec.rb +0 -85
- data/spec/support/shared/operation.rb +0 -100
@@ -1,4 +1,4 @@
|
|
1
|
-
def
|
1
|
+
def make_server(mode, options = {})
|
2
2
|
tags = options[:tags] || {}
|
3
3
|
average_round_trip_time = options[:average_round_trip_time] || 0
|
4
4
|
|
@@ -30,8 +30,8 @@ shared_context 'server selector' do
|
|
30
30
|
let(:server_tags) do
|
31
31
|
{ 'test' => 'tag', 'other' => 'tag' }
|
32
32
|
end
|
33
|
-
let(:primary) {
|
34
|
-
let(:secondary) {
|
33
|
+
let(:primary) { make_server(:primary) }
|
34
|
+
let(:secondary) { make_server(:secondary) }
|
35
35
|
let(:options) { { :mode => name, :tag_sets => tag_sets } }
|
36
36
|
let(:selector) { described_class.new(options) }
|
37
37
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyler Brock
|
@@ -32,7 +32,7 @@ cert_chain:
|
|
32
32
|
EhIn2f8suSc9QAqYt7w4T+PMtjxWTVcXs+Uy2PbDtjhtEBz6ZsP6YSsOpJbrCjCV
|
33
33
|
wZtXjpRUvWz86V5vjhHCTE8fqfEb85aeDwUCckPzpio=
|
34
34
|
-----END CERTIFICATE-----
|
35
|
-
date: 2016-
|
35
|
+
date: 2016-08-16 00:00:00.000000000 Z
|
36
36
|
dependencies:
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: bson
|
@@ -40,14 +40,14 @@ dependencies:
|
|
40
40
|
requirements:
|
41
41
|
- - "~>"
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: '4.
|
43
|
+
version: '4.1'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
46
|
version_requirements: !ruby/object:Gem::Requirement
|
47
47
|
requirements:
|
48
48
|
- - "~>"
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version: '4.
|
50
|
+
version: '4.1'
|
51
51
|
description: A Ruby driver for MongoDB
|
52
52
|
email: mongodb-dev@googlegroups.com
|
53
53
|
executables:
|
@@ -60,7 +60,6 @@ files:
|
|
60
60
|
- README.md
|
61
61
|
- Rakefile
|
62
62
|
- bin/mongo_console
|
63
|
-
- lib/csasl/csasl.bundle
|
64
63
|
- lib/mongo.rb
|
65
64
|
- lib/mongo/address.rb
|
66
65
|
- lib/mongo/address/ipv4.rb
|
@@ -89,6 +88,7 @@ files:
|
|
89
88
|
- lib/mongo/bulk_write/validatable.rb
|
90
89
|
- lib/mongo/client.rb
|
91
90
|
- lib/mongo/cluster.rb
|
91
|
+
- lib/mongo/cluster/cursor_reaper.rb
|
92
92
|
- lib/mongo/cluster/topology.rb
|
93
93
|
- lib/mongo/cluster/topology/replica_set.rb
|
94
94
|
- lib/mongo/cluster/topology/sharded.rb
|
@@ -313,6 +313,7 @@ files:
|
|
313
313
|
- spec/mongo/bulk_write/unordered_combiner_spec.rb
|
314
314
|
- spec/mongo/bulk_write_spec.rb
|
315
315
|
- spec/mongo/client_spec.rb
|
316
|
+
- spec/mongo/cluster/cursor_reaper_spec.rb
|
316
317
|
- spec/mongo/cluster/topology/replica_set_spec.rb
|
317
318
|
- spec/mongo/cluster/topology/sharded_spec.rb
|
318
319
|
- spec/mongo/cluster/topology/single_spec.rb
|
@@ -382,7 +383,6 @@ files:
|
|
382
383
|
- spec/mongo/operation/write/drop_index_spec.rb
|
383
384
|
- spec/mongo/operation/write/insert_spec.rb
|
384
385
|
- spec/mongo/operation/write/remove_user_spec.rb
|
385
|
-
- spec/mongo/operation/write/response_spec.rb
|
386
386
|
- spec/mongo/operation/write/update_spec.rb
|
387
387
|
- spec/mongo/operation/write/update_user_spec.rb
|
388
388
|
- spec/mongo/options/redacted_spec.rb
|
@@ -552,7 +552,6 @@ files:
|
|
552
552
|
- spec/support/server_selection/selection/Single/read/SecondaryPreferred.yml
|
553
553
|
- spec/support/server_selection/selection/Unknown/read/SecondaryPreferred.yml
|
554
554
|
- spec/support/server_selection_rtt.rb
|
555
|
-
- spec/support/shared/operation.rb
|
556
555
|
- spec/support/shared/protocol.rb
|
557
556
|
- spec/support/shared/server_selector.rb
|
558
557
|
- spec/support/travis.rb
|
@@ -599,6 +598,7 @@ test_files:
|
|
599
598
|
- spec/mongo/bulk_write/unordered_combiner_spec.rb
|
600
599
|
- spec/mongo/bulk_write_spec.rb
|
601
600
|
- spec/mongo/client_spec.rb
|
601
|
+
- spec/mongo/cluster/cursor_reaper_spec.rb
|
602
602
|
- spec/mongo/cluster/topology/replica_set_spec.rb
|
603
603
|
- spec/mongo/cluster/topology/sharded_spec.rb
|
604
604
|
- spec/mongo/cluster/topology/single_spec.rb
|
@@ -668,7 +668,6 @@ test_files:
|
|
668
668
|
- spec/mongo/operation/write/drop_index_spec.rb
|
669
669
|
- spec/mongo/operation/write/insert_spec.rb
|
670
670
|
- spec/mongo/operation/write/remove_user_spec.rb
|
671
|
-
- spec/mongo/operation/write/response_spec.rb
|
672
671
|
- spec/mongo/operation/write/update_spec.rb
|
673
672
|
- spec/mongo/operation/write/update_user_spec.rb
|
674
673
|
- spec/mongo/options/redacted_spec.rb
|
@@ -838,8 +837,6 @@ test_files:
|
|
838
837
|
- spec/support/server_selection/selection/Unknown/read/SecondaryPreferred.yml
|
839
838
|
- spec/support/server_selection.rb
|
840
839
|
- spec/support/server_selection_rtt.rb
|
841
|
-
- spec/support/shared/operation.rb
|
842
840
|
- spec/support/shared/protocol.rb
|
843
841
|
- spec/support/shared/server_selector.rb
|
844
842
|
- spec/support/travis.rb
|
845
|
-
has_rdoc: yard
|
metadata.gz.sig
CHANGED
Binary file
|
data/lib/csasl/csasl.bundle
DELETED
Binary file
|
@@ -1,85 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
# describe Mongo::Operation::Write::Response do
|
4
|
-
|
5
|
-
# describe '#initialize' do
|
6
|
-
|
7
|
-
# let(:response) do
|
8
|
-
# described_class.new(reply)
|
9
|
-
# end
|
10
|
-
|
11
|
-
# context 'when the reply is successful' do
|
12
|
-
|
13
|
-
# let(:reply) do
|
14
|
-
# Mongo::Protocol::Reply.new
|
15
|
-
# end
|
16
|
-
|
17
|
-
# let(:documents) do
|
18
|
-
# [{ 'ok' => 1.0, 'n' => 1 }]
|
19
|
-
# end
|
20
|
-
|
21
|
-
# before do
|
22
|
-
# reply.instance_variable_set(:@documents, documents)
|
23
|
-
# end
|
24
|
-
|
25
|
-
# it 'sets the documents on the response' do
|
26
|
-
# expect(response.documents).to eq(documents)
|
27
|
-
# end
|
28
|
-
|
29
|
-
# it 'sets the written count' do
|
30
|
-
# expect(response.n).to eq(1)
|
31
|
-
# end
|
32
|
-
# end
|
33
|
-
|
34
|
-
# context 'when the reply is not successful' do
|
35
|
-
|
36
|
-
# let(:reply) do
|
37
|
-
# Mongo::Protocol::Reply.new
|
38
|
-
# end
|
39
|
-
|
40
|
-
# let(:documents) do
|
41
|
-
# [{ 'ok' => 0.0, 'n' => 1 }]
|
42
|
-
# end
|
43
|
-
|
44
|
-
# before do
|
45
|
-
# reply.instance_variable_set(:@documents, documents)
|
46
|
-
# end
|
47
|
-
|
48
|
-
# it 'raises an exception' do
|
49
|
-
# expect { response }.to raise_error
|
50
|
-
# end
|
51
|
-
# end
|
52
|
-
|
53
|
-
# context 'when the reply is nil' do
|
54
|
-
|
55
|
-
# let(:reply) { nil }
|
56
|
-
|
57
|
-
# it 'does not raise an exception' do
|
58
|
-
# expect(response.documents).to be_empty
|
59
|
-
# end
|
60
|
-
|
61
|
-
# it 'does not set the written count' do
|
62
|
-
# expect(response.n).to be_nil
|
63
|
-
# end
|
64
|
-
# end
|
65
|
-
|
66
|
-
# context 'when providing a count' do
|
67
|
-
|
68
|
-
# let(:reply) do
|
69
|
-
# Mongo::Protocol::Reply.new
|
70
|
-
# end
|
71
|
-
|
72
|
-
# let(:response) do
|
73
|
-
# described_class.new(reply, 5)
|
74
|
-
# end
|
75
|
-
|
76
|
-
# before do
|
77
|
-
# reply.instance_variable_set(:@documents, [{ 'ok' => 1 }])
|
78
|
-
# end
|
79
|
-
|
80
|
-
# it 'sets the document count' do
|
81
|
-
# expect(response.n).to eq(5)
|
82
|
-
# end
|
83
|
-
# end
|
84
|
-
# end
|
85
|
-
# end
|
@@ -1,100 +0,0 @@
|
|
1
|
-
shared_context 'operation' do
|
2
|
-
|
3
|
-
let(:db_name) { TEST_DB }
|
4
|
-
let(:coll_name) { TEST_COLL }
|
5
|
-
let(:write_concern) { Mongo::WriteConcern.get(:w => 1) }
|
6
|
-
let(:options) { {} }
|
7
|
-
|
8
|
-
let(:cluster_double) do
|
9
|
-
double('cluster')
|
10
|
-
end
|
11
|
-
|
12
|
-
# Server doubles
|
13
|
-
let(:secondary_server) do
|
14
|
-
double('secondary_server').tap do |s|
|
15
|
-
allow(s).to receive(:secondary?) { true }
|
16
|
-
allow(s).to receive(:primary?) { false }
|
17
|
-
allow(s).to receive(:standalone?) { false }
|
18
|
-
end
|
19
|
-
end
|
20
|
-
let(:primary_server) do
|
21
|
-
double('primary_server').tap do |s|
|
22
|
-
allow(s).to receive(:primary?) { true }
|
23
|
-
allow(s).to receive(:secondary?) { false }
|
24
|
-
allow(s).to receive(:standalone?) { false }
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
let(:features_2_4) do
|
29
|
-
double('features').tap do |cxt|
|
30
|
-
allow(cxt).to receive(:write_command_enabled?) { false }
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
let(:features_2_6) do
|
35
|
-
double('features').tap do |cxt|
|
36
|
-
allow(cxt).to receive(:write_command_enabled?) { true }
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
# Context doubles
|
41
|
-
let(:primary_context) do
|
42
|
-
double('primary_context').tap do |cxt|
|
43
|
-
allow(cxt).to receive(:with_connection).and_yield(connection)
|
44
|
-
allow(cxt).to receive(:server) { primary_server }
|
45
|
-
allow(cxt).to receive(:features) { features_2_6 }
|
46
|
-
allow(cxt).to receive(:mongos?) { false }
|
47
|
-
allow(cxt).to receive(:primary?) { true }
|
48
|
-
allow(cxt).to receive(:secondary?) { false }
|
49
|
-
allow(cxt).to receive(:standalone?) { false }
|
50
|
-
allow(cxt).to receive(:cluster) { cluster_double }
|
51
|
-
allow(cluster_double).to receive(:single?) { false }
|
52
|
-
end
|
53
|
-
end
|
54
|
-
let(:secondary_context) do
|
55
|
-
double('secondary_context').tap do |cxt|
|
56
|
-
allow(cxt).to receive(:with_connection).and_yield(connection)
|
57
|
-
allow(cxt).to receive(:server) { secondary_server }
|
58
|
-
allow(cxt).to receive(:mongos?) { false }
|
59
|
-
allow(cxt).to receive(:features) { features_2_6 }
|
60
|
-
allow(cxt).to receive(:secondary?) { true }
|
61
|
-
allow(cxt).to receive(:primary?) { false }
|
62
|
-
allow(cxt).to receive(:standalone?) { false }
|
63
|
-
allow(cxt).to receive(:cluster) { cluster_double }
|
64
|
-
allow(cluster_double).to receive(:single?) { false }
|
65
|
-
end
|
66
|
-
end
|
67
|
-
let(:secondary_context_slave) do
|
68
|
-
double('secondary_context').tap do |cxt|
|
69
|
-
allow(cxt).to receive(:with_connection).and_yield(connection)
|
70
|
-
allow(cxt).to receive(:server) { secondary_server }
|
71
|
-
allow(cxt).to receive(:mongos?) { false }
|
72
|
-
allow(cxt).to receive(:features) { features_2_6 }
|
73
|
-
allow(cxt).to receive(:secondary?) { true }
|
74
|
-
allow(cxt).to receive(:primary?) { false }
|
75
|
-
allow(cxt).to receive(:standalone?) { false }
|
76
|
-
allow(cxt).to receive(:cluster) { cluster_double }
|
77
|
-
allow(cluster_double).to receive(:single?) { true }
|
78
|
-
end
|
79
|
-
end
|
80
|
-
let(:primary_context_2_4_version) do
|
81
|
-
double('primary_context').tap do |cxt|
|
82
|
-
allow(cxt).to receive(:with_connection).and_yield(connection)
|
83
|
-
allow(cxt).to receive(:server) { primary_server }
|
84
|
-
allow(cxt).to receive(:mongos?) { false }
|
85
|
-
allow(cxt).to receive(:primary?) { true }
|
86
|
-
allow(cxt).to receive(:secondary?) { false }
|
87
|
-
allow(cxt).to receive(:standalone?) { false }
|
88
|
-
allow(cxt).to receive(:cluster) { cluster_double }
|
89
|
-
allow(cluster_double).to receive(:single?) { false }
|
90
|
-
allow(cxt).to receive(:features) { features_2_4 }
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
let(:connection) do
|
95
|
-
double('connection').tap do |conn|
|
96
|
-
allow(conn).to receive(:dispatch) { [] }
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|