adapter-mongo 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +4 -4
- data/Gemfile +1 -1
- data/adapter-mongo.gemspec +1 -1
- data/lib/adapter/mongo/version.rb +1 -1
- data/spec/mongo_atomic_spec.rb +1 -1
- data/spec/support/shared_mongo_adapter.rb +24 -24
- metadata +16 -28
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 13706bec9bf9895c079cea6dcab1dae400dcb3ed
|
4
|
+
data.tar.gz: e11bc68c4d4f6d072d2dc92118cffd0ef5505fbd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0672a7392cb15de3a7353a4b09b3155fd58f99f9c098d19a7e66533cc945413af764ce5d05b02923702aa5d761763834dc81683dd369169c20cc0e8f9c81ccbc
|
7
|
+
data.tar.gz: 3cc40abe33f3eee00ac1b0cd9be97daac0ba648d9e50ffcb7f8aae2eee55bf5972f596cc632bfad38ad395049a6908b5d40e6d189412f9c4a7ba0e58d942fe55
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/adapter-mongo.gemspec
CHANGED
@@ -17,6 +17,6 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
18
|
s.require_paths = ["lib"]
|
19
19
|
|
20
|
-
s.add_dependency 'adapter', '0.7.
|
20
|
+
s.add_dependency 'adapter', '~> 0.7.1'
|
21
21
|
s.add_dependency 'mongo', '~> 1.8'
|
22
22
|
end
|
data/spec/mongo_atomic_spec.rb
CHANGED
@@ -5,29 +5,29 @@ shared_examples_for "a mongo adapter" do
|
|
5
5
|
id = BSON::ObjectId.new
|
6
6
|
attributes = {'one' => 'two'}
|
7
7
|
adapter.write(id, attributes)
|
8
|
-
client.find_one('_id' => id).
|
9
|
-
adapter.read(id).
|
8
|
+
expect(client.find_one('_id' => id)).not_to be_nil
|
9
|
+
expect(adapter.read(id)).to eq(attributes)
|
10
10
|
end
|
11
11
|
|
12
12
|
it "allows using ordered hashes as keys" do
|
13
13
|
key = BSON::OrderedHash['d', 1, 'n', 1]
|
14
14
|
attributes = {'one' => 'two'}
|
15
15
|
adapter.write(key, attributes)
|
16
|
-
client.find_one('_id' => key).
|
17
|
-
adapter.read(key).
|
16
|
+
expect(client.find_one('_id' => key)).not_to be_nil
|
17
|
+
expect(adapter.read(key)).to eq(attributes)
|
18
18
|
end
|
19
19
|
|
20
20
|
it "allows using hashes as keys" do
|
21
21
|
key = {:d => 1}
|
22
22
|
attributes = {'one' => 'two'}
|
23
23
|
adapter.write(key, attributes)
|
24
|
-
client.find_one('_id' => key).
|
25
|
-
adapter.read(key).
|
24
|
+
expect(client.find_one('_id' => key)).not_to be_nil
|
25
|
+
expect(adapter.read(key)).to eq(attributes)
|
26
26
|
end
|
27
27
|
|
28
28
|
it "stores hashes right in document" do
|
29
29
|
adapter.write('foo', 'steak' => 'bacon')
|
30
|
-
client.find_one('_id' => 'foo').
|
30
|
+
expect(client.find_one('_id' => 'foo')).to eq({'_id' => 'foo', 'steak' => 'bacon'})
|
31
31
|
end
|
32
32
|
|
33
33
|
describe "with safe option" do
|
@@ -43,16 +43,16 @@ shared_examples_for "a mongo adapter" do
|
|
43
43
|
|
44
44
|
it "does not raise operation failure on write if operation succeeds" do
|
45
45
|
adapter.write(BSON::ObjectId.new, {'email' => 'john@orderedlist.com'})
|
46
|
-
|
46
|
+
expect {
|
47
47
|
adapter.write(BSON::ObjectId.new, {'email' => 'steve@orderedlist.com'})
|
48
|
-
}.
|
48
|
+
}.not_to raise_error
|
49
49
|
end
|
50
50
|
|
51
51
|
it "raises operation failure on write if operation fails" do
|
52
52
|
adapter.write(BSON::ObjectId.new, {'email' => 'john@orderedlist.com'})
|
53
|
-
|
53
|
+
expect {
|
54
54
|
adapter.write(BSON::ObjectId.new, {'email' => 'john@orderedlist.com'})
|
55
|
-
}.
|
55
|
+
}.to raise_error(Mongo::OperationFailure)
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
@@ -68,16 +68,16 @@ shared_examples_for "a mongo adapter" do
|
|
68
68
|
|
69
69
|
it "does not raise operation failure on write if operation succeeds" do
|
70
70
|
adapter.write(BSON::ObjectId.new, {'email' => 'john@orderedlist.com'})
|
71
|
-
|
71
|
+
expect {
|
72
72
|
adapter.write(BSON::ObjectId.new, {'email' => 'steve@orderedlist.com'})
|
73
|
-
}.
|
73
|
+
}.not_to raise_error
|
74
74
|
end
|
75
75
|
|
76
76
|
it "does not raise operation failure on write if operation fails" do
|
77
77
|
adapter.write(BSON::ObjectId.new, {'email' => 'john@orderedlist.com'})
|
78
|
-
|
78
|
+
expect {
|
79
79
|
adapter.write(BSON::ObjectId.new, {'email' => 'john@orderedlist.com'})
|
80
|
-
}.
|
80
|
+
}.not_to raise_error
|
81
81
|
end
|
82
82
|
end
|
83
83
|
end
|
@@ -94,21 +94,21 @@ shared_examples_for "a mongo adapter" do
|
|
94
94
|
|
95
95
|
it "does not raise operation failure on write if operation succeeds" do
|
96
96
|
adapter.write(BSON::ObjectId.new, {'email' => 'john@orderedlist.com'})
|
97
|
-
|
97
|
+
expect {
|
98
98
|
adapter.write(BSON::ObjectId.new, {'email' => 'steve@orderedlist.com'})
|
99
|
-
}.
|
99
|
+
}.not_to raise_error
|
100
100
|
end
|
101
101
|
|
102
102
|
it "raises operation failure on write if operation fails" do
|
103
103
|
adapter.write(BSON::ObjectId.new, {'email' => 'john@orderedlist.com'})
|
104
|
-
|
104
|
+
expect {
|
105
105
|
adapter.write(BSON::ObjectId.new, {'email' => 'john@orderedlist.com'})
|
106
|
-
}.
|
106
|
+
}.to raise_error(Mongo::OperationFailure)
|
107
107
|
end
|
108
108
|
|
109
109
|
it "allows overriding write concern for write" do
|
110
110
|
id = BSON::ObjectId.new
|
111
|
-
client.
|
111
|
+
expect(client).to receive(:update).
|
112
112
|
with(
|
113
113
|
hash_including(:_id),
|
114
114
|
kind_of(Hash),
|
@@ -119,25 +119,25 @@ shared_examples_for "a mongo adapter" do
|
|
119
119
|
|
120
120
|
it "uses write concern for delete" do
|
121
121
|
id = BSON::ObjectId.new
|
122
|
-
client.
|
122
|
+
expect(client).to receive(:remove).with({:_id => id}, :w => 1)
|
123
123
|
adapter.delete(id)
|
124
124
|
end
|
125
125
|
|
126
126
|
it "allows overriding write concern for delete" do
|
127
127
|
id = BSON::ObjectId.new
|
128
|
-
client.
|
128
|
+
expect(client).to receive(:remove).with({:_id => id}, :w => 0)
|
129
129
|
adapter.delete(id, :w => 0)
|
130
130
|
end
|
131
131
|
|
132
132
|
it "uses write concern for clear" do
|
133
133
|
id = BSON::ObjectId.new
|
134
|
-
client.
|
134
|
+
expect(client).to receive(:remove).with({}, :w => 1)
|
135
135
|
adapter.clear
|
136
136
|
end
|
137
137
|
|
138
138
|
it "allows overriding write concern for clear" do
|
139
139
|
id = BSON::ObjectId.new
|
140
|
-
client.
|
140
|
+
expect(client).to receive(:remove).with({}, :w => 0)
|
141
141
|
adapter.clear(:w => 0)
|
142
142
|
end
|
143
143
|
end
|
metadata
CHANGED
@@ -1,46 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adapter-mongo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
5
|
-
prerelease:
|
4
|
+
version: 0.8.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- John Nunemaker
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-12-30 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: adapter
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.7.
|
19
|
+
version: 0.7.1
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.7.
|
26
|
+
version: 0.7.1
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: mongo
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- - ~>
|
31
|
+
- - "~>"
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '1.8'
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- - ~>
|
38
|
+
- - "~>"
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '1.8'
|
46
41
|
description: Adapter for mongo
|
@@ -50,9 +45,9 @@ executables: []
|
|
50
45
|
extensions: []
|
51
46
|
extra_rdoc_files: []
|
52
47
|
files:
|
53
|
-
- .gitignore
|
54
|
-
- .rspec
|
55
|
-
- .travis.yml
|
48
|
+
- ".gitignore"
|
49
|
+
- ".rspec"
|
50
|
+
- ".travis.yml"
|
56
51
|
- Gemfile
|
57
52
|
- Guardfile
|
58
53
|
- LICENSE
|
@@ -72,33 +67,26 @@ files:
|
|
72
67
|
- spec/support/shared_mongo_adapter.rb
|
73
68
|
homepage: ''
|
74
69
|
licenses: []
|
70
|
+
metadata: {}
|
75
71
|
post_install_message:
|
76
72
|
rdoc_options: []
|
77
73
|
require_paths:
|
78
74
|
- lib
|
79
75
|
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
-
none: false
|
81
76
|
requirements:
|
82
|
-
- -
|
77
|
+
- - ">="
|
83
78
|
- !ruby/object:Gem::Version
|
84
79
|
version: '0'
|
85
|
-
segments:
|
86
|
-
- 0
|
87
|
-
hash: -2103584337757372266
|
88
80
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
81
|
requirements:
|
91
|
-
- -
|
82
|
+
- - ">="
|
92
83
|
- !ruby/object:Gem::Version
|
93
84
|
version: '0'
|
94
|
-
segments:
|
95
|
-
- 0
|
96
|
-
hash: -2103584337757372266
|
97
85
|
requirements: []
|
98
86
|
rubyforge_project:
|
99
|
-
rubygems_version:
|
87
|
+
rubygems_version: 2.2.2
|
100
88
|
signing_key:
|
101
|
-
specification_version:
|
89
|
+
specification_version: 4
|
102
90
|
summary: Adapter for mongo
|
103
91
|
test_files:
|
104
92
|
- spec/helper.rb
|