mongodb-mongo 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/mongo/gridfs/grid_store.rb +1 -1
- data/mongo-ruby-driver.gemspec +2 -2
- data/tests/mongo-qa/circular +16 -0
- data/tests/test_grid_store.rb +26 -0
- metadata +2 -2
data/mongo-ruby-driver.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'mongo'
|
3
|
-
s.version = '0.5.
|
3
|
+
s.version = '0.5.1'
|
4
4
|
s.platform = Gem::Platform::RUBY
|
5
5
|
s.summary = 'Simple pure-Ruby driver for the 10gen Mongo DB'
|
6
6
|
s.description = 'A pure-Ruby driver for the 10gen Mongo DB. For more information about Mongo, see http://www.mongodb.org.'
|
@@ -45,7 +45,7 @@ Gem::Specification.new do |s|
|
|
45
45
|
'README.rdoc', 'Rakefile', 'mongo-ruby-driver.gemspec']
|
46
46
|
s.test_files = ['tests/mongo-qa/_common.rb',
|
47
47
|
'tests/mongo-qa/capped',
|
48
|
-
'tests/mongo-qa/
|
48
|
+
'tests/mongo-qa/circular',
|
49
49
|
'tests/mongo-qa/count1',
|
50
50
|
'tests/mongo-qa/find',
|
51
51
|
'tests/mongo-qa/remove',
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require File.join(File.dirname(__FILE__), '_common.rb')
|
4
|
+
db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
|
5
|
+
|
6
|
+
colla = db.collection('a')
|
7
|
+
collb = db.collection('b')
|
8
|
+
collc = db.collection('c')
|
9
|
+
|
10
|
+
colla.insert('c' => 'b')
|
11
|
+
collb.insert('c' => 1)
|
12
|
+
|
13
|
+
x_id = ObjectID.new
|
14
|
+
x_dbref = DBRef.new(nil, 'thiz', db, 'c', x_id)
|
15
|
+
x = {'_id' => x_id, 'that' => 2, 'thiz' => x_dbref}
|
16
|
+
collc.insert(x)
|
data/tests/test_grid_store.rb
CHANGED
@@ -73,6 +73,32 @@ class GridStoreTest < Test::Unit::TestCase
|
|
73
73
|
assert_equal "world!", GridStore.read(@db, 'foobar', nil, 7)
|
74
74
|
end
|
75
75
|
|
76
|
+
def test_seek
|
77
|
+
GridStore.open(@db, 'foobar', 'r') { |f|
|
78
|
+
f.seek(0)
|
79
|
+
assert_equal 'h', f.getc.chr
|
80
|
+
f.seek(7)
|
81
|
+
assert_equal 'w', f.getc.chr
|
82
|
+
f.seek(4)
|
83
|
+
assert_equal 'o', f.getc.chr
|
84
|
+
|
85
|
+
f.seek(-1, IO::SEEK_END)
|
86
|
+
assert_equal '!', f.getc.chr
|
87
|
+
f.seek(-6, IO::SEEK_END)
|
88
|
+
assert_equal 'w', f.getc.chr
|
89
|
+
|
90
|
+
f.seek(0)
|
91
|
+
f.seek(7, IO::SEEK_CUR)
|
92
|
+
assert_equal 'w', f.getc.chr
|
93
|
+
f.seek(-1, IO::SEEK_CUR)
|
94
|
+
assert_equal 'w', f.getc.chr
|
95
|
+
f.seek(-4, IO::SEEK_CUR)
|
96
|
+
assert_equal 'o', f.getc.chr
|
97
|
+
f.seek(3, IO::SEEK_CUR)
|
98
|
+
assert_equal 'o', f.getc.chr
|
99
|
+
}
|
100
|
+
end
|
101
|
+
|
76
102
|
def test_multi_chunk
|
77
103
|
@chunks.clear
|
78
104
|
@files.clear
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongodb-mongo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jim Menard
|
@@ -92,7 +92,7 @@ summary: Simple pure-Ruby driver for the 10gen Mongo DB
|
|
92
92
|
test_files:
|
93
93
|
- tests/mongo-qa/_common.rb
|
94
94
|
- tests/mongo-qa/capped
|
95
|
-
- tests/mongo-qa/
|
95
|
+
- tests/mongo-qa/circular
|
96
96
|
- tests/mongo-qa/count1
|
97
97
|
- tests/mongo-qa/find
|
98
98
|
- tests/mongo-qa/remove
|