mongodb-mongo 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mongo/db.rb +0 -11
- data/mongo-ruby-driver.gemspec +1 -1
- data/tests/test_db.rb +1 -13
- metadata +1 -1
data/lib/mongo/db.rb
CHANGED
@@ -121,17 +121,6 @@ module XGen
|
|
121
121
|
raise "error: failed to connect to any given host:port" unless @socket
|
122
122
|
end
|
123
123
|
|
124
|
-
# Add a new user to the database.
|
125
|
-
def add_user(username, password)
|
126
|
-
coll = collection(SYSTEM_USER_COLLECTION)
|
127
|
-
coll.insert(:user => username, :pwd => hash_password(password))
|
128
|
-
end
|
129
|
-
|
130
|
-
def delete_user(username)
|
131
|
-
coll = collection(SYSTEM_USER_COLLECTION)
|
132
|
-
coll.remove(:user => username)
|
133
|
-
end
|
134
|
-
|
135
124
|
# Returns true if +username+ has +password+ in
|
136
125
|
# +SYSTEM_USER_COLLECTION+. +name+ is username, +password+ is
|
137
126
|
# plaintext password.
|
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.2.
|
3
|
+
s.version = '0.2.3'
|
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.'
|
data/tests/test_db.rb
CHANGED
@@ -24,7 +24,7 @@ class DBTest < Test::Unit::TestCase
|
|
24
24
|
@spongebob_password = 'squarepants'
|
25
25
|
@users = @db.collection('system.users')
|
26
26
|
@users.clear
|
27
|
-
@
|
27
|
+
@users.insert(:user => @spongebob, :pwd => @db.send(:hash_password, @spongebob_password))
|
28
28
|
end
|
29
29
|
|
30
30
|
def teardown
|
@@ -91,18 +91,6 @@ class DBTest < Test::Unit::TestCase
|
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
|
-
def test_add_user
|
95
|
-
assert_equal 1, @users.count
|
96
|
-
doc = @users.find({}, :limit => 1).next_object
|
97
|
-
assert_equal @spongebob, doc['user']
|
98
|
-
assert_equal Digest::MD5.hexdigest("mongo#{@spongebob_password}"), doc['pwd']
|
99
|
-
end
|
100
|
-
|
101
|
-
def test_delete_user
|
102
|
-
@db.delete_user(@spongebob)
|
103
|
-
assert_equal 0, @users.count
|
104
|
-
end
|
105
|
-
|
106
94
|
def test_authenticate
|
107
95
|
assert !@db.authenticate('nobody', 'nopassword')
|
108
96
|
assert !@db.authenticate(@spongebob, 'squareliederhosen')
|